-
Notifications
You must be signed in to change notification settings - Fork 3k
NRF52 serial fixes #8784
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
NRF52 serial fixes #8784
Conversation
In nordic_nrf5_uart_event_handler if the events NRF_UARTE_EVENT_ENDRX and NRF_UARTE_EVENT_RXSTARTED become pending after the check for NRF_UARTE_EVENT_ENDRX but before the check for NRF_UARTE_EVENT_RXSTARTED the RX DMA buffers will be setup incorrectly by nordic_nrf5_uart_event_handler_rxstarted because active_bank hasn't been updated. This cause dropped and incorrect data. This patch fixes that problem by adding a second check for NRF_UARTE_EVENT_ENDRX after checking for NRF_UARTE_EVENT_RXSTARTED and skipping processing if NRF_UARTE_EVENT_ENDRX is set. The subsequent interrupt will process both in the correct order. This ensures that these events cannot be handled out of order and thus fixes the corruption.
Busy-wait before sending a charecter instead of after. If serial_writeable has been called first, the busy-wait loop will be skipped. Added initialization code to ensure NRF_UARTE_EVENT_TXDRDY is armed correctly.
When attaching an irq to serial call nordic_nrf5_serial_configure. This ensures the serial is ready to receive data at the correct baudrate.
Interesting. Gonna do a whole bunch of test Test CI runs. |
/morph build |
/morph build |
Build : SUCCESSBuild number : 3660 Triggering tests/morph test |
1 similar comment
Build : SUCCESSBuild number : 3660 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 3268 |
Info: This PR has been re-bundled into a new rollup PR (#8800). No further work is needed here, as once that PR is merged, this PR will also be closed and marked as merged. |
Reworking my rollup, this still needs work as I was told (needs:w ork now here) |
Make the following enhancement: -Support serial port use without flow control -Prevent dropped bytes by updating flow control handling -Remove dead code Serial port use without flow control: In the prior implementation there was a window of time between reloading DMA buffers after a timeout where bytes could be dropped. This is because the uart needed to be turned off in order to flush the bytes in the DMA buffer. This change configures the DMA buffer to only receive one byte at a time so there is no need to disable the uart to flush it. After each byte is received the DMA transfer will be over so the transfer will never be partially complete and need flushing. Since the uart is always on it is safe to use it even without flow control. Prevent dropped bytes by updating flow control handling: To prevent dropped bytes due to high latency the flow control handling of the RTS line was configured to be asserted automatically by hardware after each byte. Once the CPU has read the byte and setup the next receive buffer the RTS line is deasserted to the transfer can continue. This ensure that when flow control is enabled data won't be lost due to interrupt latency. Remove dead code: With the above changes there is a lot of dead code, such as the timer handling code. This patch removes the code that is no longer used.
When the RX FIFO is nearly full use flow control to stop receiving data.
I fixed all the issues I have seen so far. This should be ready for testing. With these new commits the NRF52 should work reliably without flow control if interrupt latency is good, and should work reliably regardless of interrupt latency if flow control is on. |
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.
Looks good to me. Removing the DMA config parameter altogether will be a compatibility glitch, but then anyone who was manually configuring it should be rechecking what parameters they need, if any, after the change - presumably default parameters should be solid now.
/morph build |
Build : SUCCESSBuild number : 3682 Triggering tests/morph test |
Test : FAILUREBuild number : 3458 |
No NRF5x issue here, known tracked issues |
Exporter Build : FAILUREBuild number : 3285 |
EOFError error in the exporter CI |
Thanks Russ! Look awesome! 😄 |
Kari and Veijo have been making positive noises about this+ESP8266+mbed client. I think it's cleared all our problems (in conjunction with Marcus's other PRs). |
/morph build |
Build : FAILUREBuild number : 3702 |
restarting
/morph build |
Build : ABORTEDBuild number : 3703 |
When initializing serial disable all interrupts as some of these may have been enabled by a bootloader. This ensures that the NRF52 serial driver remains compatible with any bootloader version.
Add a commit to fix backwards compatibility with older bootloaders |
Test run: SUCCESSSummary: 4 of 4 test jobs passed |
Description
Fix a few serial problems on the NRF52:
Pull request type