Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/xbee: disable CTS/RTS pin unless periph_uart_hw_fc is used #13224

Merged
merged 1 commit into from
Apr 24, 2020

Conversation

fjmolinas
Copy link
Contributor

Contribution description

If usinng an arduino xbee shield then CTS pin will be wired to the
ICSP connector RESET pin.

If also used on an arduino-% board then if xbee is busy sending or
receiving data it will assert CTS and this will trigger a reset on
the board.

To avoid this disable CTS functionality on start up.

Testing procedure

  • On master if using arduino-zero + xbee the following should be enough to overload the xbee and
    cause it to assert CTS: ping6 -c 1000 -s 90 -i 100 and cause a reset.
2020-01-28 18:16:36,074 # main(): This is RIOT! (Version: 2020.04-devel-124-gd5a5b-HEAD)
2020-01-28 18:16:36,078 # RIOT network stack example application
2020-01-28 18:16:36,080 # All up, running the shell now
> 2020-01-28 18:16:40,543 #  gnrc_netif: netdev init failed: -5

Is debugging is enabled you can see it resets untill it fails to init the driver, which is another issue.

2020-01-27 10:17:54,488 # [xbee] AT_CMD: SL                                                                                                                                                                                                                               [81/1521]
2020-01-27 10:17:54,928 # [xbee] AT_CMD: CH                                                                                                                                                                                                                                        
2020-01-27 10:17:55,291 # [xbee] AT_CMD: ID                                                                                                                                                                                                                                        
2020-01-27 10:17:55,802 # [xbee] init: Initialization successful                                                                                                                                                                                                                   
2020-01-27 10:17:55,804 # [xbee] AT_CMD: MY���                                                                                                                                                                                                                                     
2020-01-27 10:17:56,239 # [xbee] isr: data available, waiting for read                                                                                                                                                                                                             
2020-01-27 10:17:56,243 # [xbee] recv: reading size without dropping: 106                                                                                                                                                                                                          
2020-01-27 10:17:56,247 # [xbee] recv: consuming packet: reading 106 byte                                                                                                                                                                                                          
2020-01-27 10:17:56,251 # [xbee] send: now sending out 36 byte                                                                                                                                                                                                                     
2020-01-27 10:17:56,293 # [xbee] send: now sending out 22 byte                                                                                                                                                                                                                     
2020-01-27 10:17:57,531 # [xbee] AT_CMD: +++                                                                                                                                                                                                                                       
2020-01-27 10:17:58,639 # [xbee] AT_CMD: ATMM2                                                                                                                                                                                                                                     
2020-01-27 10:17:58,647 # [xbee] AT_CMD: ATAP1                                                                                                                                                                                                                                     
2020-01-27 10:17:58,655 # [xbee] AT_CMD: ATAC                                                                                                                                                                                                                                      
2020-01-27 10:17:58,662 # [xbee] AT_CMD: ATCN                                                                                                                                                                                                                                      
2020-01-27 10:17:58,669 # [xbee] AT_CMD: SH                                                                                                                                                                                                                                        
2020-01-27 10:17:58,693 # [xbee] AT_CMD: SL                                                                                                                                                                                                                                        
2020-01-27 10:17:58,863 # [xbee] AT_CMD: CH                                                                                                                                                                                                                                        
2020-01-27 10:17:59,028 # [xbee] AT_CMD: ID                                                                                                                                                                                                                                        
2020-01-27 10:17:59,351 # [xbee] init: Initialization successful                                                                                                                                                                                                                   
2020-01-27 10:17:59,354 # [xbee] AT_CMD: MY���                                                                                                                                                                                                                                     
2020-01-27 10:17:59,788 # [xbee] isr: data available, waiting for read                                                                                                                                                                                                             
2020-01-27 10:17:59,793 # [xbee] recv: reading size without dropping: 106                                                                                                                                                                                                          
2020-01-27 10:17:59,797 # [xbee] recv: consuming packet: reading 106 byte
2020-01-27 10:17:59,801 # [xbee] send: now sending out 36 byte
2020-01-27 10:17:59,843 # [xbee] send: now sending out 22 byte
2020-01-27 10:17:59,873 # main(): This is RIOT! (Version: 2020.04-devel-16-g1d840-2020.01-branch)
  • With this PR it doesn't and even if there is high packet loss the node will eventually answer to subsequent pings.
2020-01-28 18:09:42,563 #  ping6 -c 100 -s 91 -i 100 fe80::213:a200:40a1:642e
2020-01-28 18:09:43,118 # 99 bytes from fe80::213:a200:40a1:642e: icmp_seq=2 ttl=64 rssi=-31 dBm time=347.089 ms
2020-01-28 18:09:43,328 # 99 bytes from fe80::213:a200:40a1:642e: icmp_seq=3 ttl=64 rssi=-31 dBm time=456.454 ms
2020-01-28 18:09:53,470 # 
2020-01-28 18:09:53,474 # --- fe80::213:a200:40a1:642e PING statistics ---
2020-01-28 18:09:53,480 # 100 packets transmitted, 2 packets received, 98% packet loss
2020-01-28 18:09:53,485 # round-trip min/avg/max = 347.089/401.771/456.454 ms
> ping6 -c 1 -s 91 -i 100 fe80::213:a200:40a1:642e 
2020-01-28 18:09:59,483 #  ping6 -c 1 -s 91 -i 100 fe80::213:a200:40a1:642e
2020-01-28 18:10:00,484 # 
2020-01-28 18:10:00,488 # --- fe80::213:a200:40a1:642e PING statistics ---
2020-01-28 18:10:00,493 # 1 packets transmitted, 0 packets received, 100% packet loss
> ping6 -c 1 -s 91 -i 100 fe80::213:a200:40a1:642e 
2020-01-28 18:10:02,107 #  ping6 -c 1 -s 91 -i 100 fe80::213:a200:40a1:642e
2020-01-28 18:10:02,417 # 99 bytes from fe80::213:a200:40a1:642e: icmp_seq=0 ttl=64 rssi=-32 dBm time=302.050 ms
2020-01-28 18:10:02,417 # 
2020-01-28 18:10:02,421 # --- fe80::213:a200:40a1:642e PING statistics ---
2020-01-28 18:10:02,427 # 1 packets transmitted, 1 packets received, 0% packet loss
2020-01-28 18:10:02,431 # round-trip min/avg/max = 302.050/302.050/302.050 ms

Related Issues

Tagging is a backport since without it task04.08 can't be run on iotlab for the release.

@fjmolinas fjmolinas added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: drivers Area: Device drivers Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch labels Jan 28, 2020
@fjmolinas fjmolinas removed the Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch label Jan 29, 2020
If usinng an arduino xbee shield then CTS pin will be wired to the
ICSP connector RESET pin.

If also used on an arduino-% board then if xbee is busy sending or
receiving data it will assert CTS and this will trigger a reset on
the board.

To avoid this disable CTS functionality on start up unless hardware
flow control is explicitly requested.
@fjmolinas fjmolinas added the Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch label Apr 24, 2020
@leandrolanzieri leandrolanzieri added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 24, 2020
Copy link
Contributor

@leandrolanzieri leandrolanzieri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good. @fjmolinas provided test results -> ACK!

@leandrolanzieri leandrolanzieri added Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines labels Apr 24, 2020
@fjmolinas fjmolinas changed the title drivers/xbee: disable CTS pin drivers/xbee: disable CTS/RTS pin unless periph_uart_hw_fc is used Apr 24, 2020
@fjmolinas
Copy link
Contributor Author

Warning is present when using HW FC:

2020-04-24 11:03:27,204 # main(): This is RIOT! (Version: 2020.07-devel-186-g922b3-pr_xbee_cts_reset)
2020-04-24 11:03:27,207 # RIOT network stack example application
2020-04-24 11:03:27,210 # All up, running the shell now
> 2020-04-24 11:03:28,300 #  [xbee] AT_CMD: +++
2020-04-24 11:03:29,407 # [xbee] AT_CMD: ATMM2
2020-04-24 11:03:29,415 # [xbee] AT_CMD: ATAP1
2020-04-24 11:03:29,436 # [xbee] init: WARNING if using an arduino BOARD + arduino xbee shield with ICSP connector, hardware flow control can't be used since CTS pin is connected to ICSP RESET pin
2020-04-24 11:03:29,438 # [xbee] AT_CMD: ATD6 0
2020-04-24 11:03:29,447 # [xbee] AT_CMD: ATD7 0
2020-04-24 11:03:29,457 # [xbee] AT_CMD: ATAC
2020-04-24 11:03:29,464 # [xbee] AT_CMD: ATCN
2020-04-24 11:03:29,470 # [xbee] AT_CMD: SH
2020-04-24 11:03:29,495 # [xbee] AT_CMD: SL
2020-04-24 11:03:29,519 # [xbee] AT_CMD: CH� 
2020-04-24 11:03:29,540 # [xbee] AT_CMD: ID
2020-04-24 11:03:29,564 # [xbee] init: Initialization successful
2020-04-24 11:03:29,566 # [xbee] AT_CMD: MY��<�
2020-04-24 11:03:29,590 # [xbee] send: now sending out 36 byte
2020-04-24 11:03:30,251 # [xbee] send: now sending out 36 byte

@leandrolanzieri leandrolanzieri merged commit e7a1b40 into RIOT-OS:master Apr 24, 2020
@fjmolinas fjmolinas deleted the pr_xbee_cts_reset branch April 24, 2020 09:19
@fjmolinas
Copy link
Contributor Author

Thanks for the review!

@leandrolanzieri
Copy link
Contributor

Backport provided in #13940

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 3-testing The PR was tested according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants