-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cpu/cc2538: Prevent underflow of the RX FIFO #13906
Conversation
@MBradbury Thanks for the fix, I'll test with an
How can this inconsistency happen? Also regarding the commits they seem to address a mix of things:
So I think it would be better for the commit history if you had the Otherwise they changes make sense. |
I'm not sure, this one has me confused. A possibility is that
Sorry about these the The RSSI assert should be removed as it checks
Sure, I can rework the PR to do this. |
ed7a735
to
22b944e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment regarding the commit length, our CI only allows commits as long as 72 in the first line. Extra information should be placed a line below, e.g for 27c58d2.
cpu/cc2538: remove check for RSSI_VALID
The RSSI assert should be removed as it checks RSSI_VALID for the RSSI register [Section 23.10.3]. Whereas my understanding of Section 23.9.7 is that the RSSI in the FCS should always be valid as it is measured during receiving the len field.
Also regarding the underflow issue, I took a look at the datasheet and it says that:
RX underflow is indicated when the RFERRF.RXUNDERF flag is set. RX underflow is a serious error condition that should not occur in error-free software, and the RXUNDERF event should be used only for debugging or in a watchdog function. The RXUNDERF error is not generated when the read operation occurs simultaneously with the reception of a new byte
My impression is that the bug you are describing is an attempt to read the FIFO when its empty. This means that it was somehow flushed before, and a second read attempt happens. Could it be that this is because we don't make a distinction between FIFOP
and RXPKTDONE
ISR, they are sometimes triggering two separate ISR?
Just to clarify its when using both at the same time or with any of them? |
I have only tested when running both at the same time (gnrc_border_router on one node and gnrc_networking on three others). |
Should I be able to easily reproduce this while simply pinging? When do you see the bug? |
I see the bug even without pinging. I flash three nodes with gnrc_networking, flash I do not receive the errors on all nodes, but on one of the gnrc_networking nodes I get:
A ping does not seem to trigger the issue. |
I only have one cc2538 based board with me, and I seem to be unable to reproduce. I'll try to get someone else to do so, but If not I'll trust your results since the code changes make sense. |
I can confirm that when running
This does not happen when using other board as BR (I tried with Applying these changes resolves the issue, and no more assertion errors are printed. |
Thanks for testing @leandrolanzieri ! @MBradbury Could you adress Travis commit length comments? |
22b944e
to
ba51e90
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, changes make sense and @leandrolanzieri confirmed it fixes the issue. Thanks for contributing the fix @MBradbury!
This commit adds NETDEV_EVENT_RX_COMPLETE, NETDEV_EVENT_TX_COMPLETE, NETDEV_EVENT_RX_STARTE & NETDEV_EVENT_CRC_ERROR. In RIOT-OS#13906 the crc lookahead had been moved because it would sometimes be inconsistent. The reason why is because since the reception is offloaded an new packet can be received before retrieving the first pkt from the FIFO. This PR fixes it by disabling reception while the frame is not processes i.e., `_recv` is not called. We also now flush at the end of a succesfull reception to now where in the fifo to probe. cc2538_off now does not flush the FIFO this the radio could be turned off after reception of a pkt but before this one is retrieved from the FIFO. This commit also adds NETOPT_STANDBY squash! cpu/cc2538: add NETDEV_EVENTs and fix reception
This commit adds NETDEV_EVENT_RX_COMPLETE, NETDEV_EVENT_TX_COMPLETE, NETDEV_EVENT_RX_START & NETDEV_EVENT_CRC_ERROR. In RIOT-OS#13906 the crc lookahead had been moved because it would sometimes be inconsistent. The reason why is because since the reception is offloaded a new packet can be received before retrieving the first pkt from the FIFO. This PR fixes it by disabling reception while the frame is not processes i.e., `_recv` is not called. We also now flush at the end of a succesfull reception to know where in the fifo to probe. cc2538_off now does not flush the FIFO this the radio could be turned off after reception of a pkt but before this one is retrieved from the FIFO.
This commit adds NETDEV_EVENT_RX_COMPLETE, NETDEV_EVENT_TX_COMPLETE, NETDEV_EVENT_RX_START & NETDEV_EVENT_CRC_ERROR. In RIOT-OS#13906 the crc lookahead had been moved because it would sometimes be inconsistent. The reason why is because since the reception is offloaded a new packet can be received before retrieving the first pkt from the FIFO. This PR fixes it by disabling reception while the frame is not processes i.e., `_recv` is not called. We also now flush at the end of a succesfull reception to know where in the fifo to probe. cc2538_off now does not flush the FIFO this the radio could be turned off after reception of a pkt but before this one is retrieved from the FIFO.
This commit adds NETDEV_EVENT_RX_COMPLETE, NETDEV_EVENT_TX_COMPLETE, NETDEV_EVENT_RX_START & NETDEV_EVENT_CRC_ERROR. In RIOT-OS#13906 the crc lookahead had been moved because it would sometimes be inconsistent. The reason why is because since the reception is offloaded a new packet can be received before retrieving the first pkt from the FIFO. This PR fixes it by disabling reception while the frame is not processes i.e., `_recv` is not called. We also now flush at the end of a succesfull reception to know where in the fifo to probe. cc2538_off now does not flush the FIFO this the radio could be turned off after reception of a pkt but before this one is retrieved from the FIFO.
This commit adds NETDEV_EVENT_RX_COMPLETE, NETDEV_EVENT_TX_COMPLETE, NETDEV_EVENT_RX_START & NETDEV_EVENT_CRC_ERROR. In RIOT-OS#13906 the crc lookahead had been moved because it would sometimes be inconsistent. The reason why is because since the reception is offloaded a new packet can be received before retrieving the first pkt from the FIFO. This PR fixes it by disabling reception while the frame is not processes i.e., `_recv` is not called. We also now flush at the end of a succesfull reception to know where in the fifo to probe. cc2538_off now does not flush the FIFO this the radio could be turned off after reception of a pkt but before this one is retrieved from the FIFO.
Contribution description
The implementation of receiving packets for CC2538 can lead to underflows of the RX FIFO when running the gnrc_border_router and gnrc_networking examples.
This PR makes the following changes:
crc_corr_val
later failed.References are to the manual available at: https://www.ti.com/lit/ug/swru191f/swru191f.pdf
Testing procedure
Tested on 4 Zolertia RE Mote Rev. Bs, with one running gnrc_border_router (with RPL enabled) and the other three running gnrc_networking. Without the patch RXUNDERF and other asserts will be printed. With the patch these asserts will not be triggered.
Issues/PRs references
Fixes original issue identified in #7020 .