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

nrfx: nrfx_uarte: Various fixes #187

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

nordic-krch
Copy link
Contributor

Various fixes for bugs found after adding a stress test.

It is possible that data from RX FIFO flushing is pending and new
on next RX enabling first provided buffer is equal or shorter compared
to the pending RX data. In that case, user buffer will be filled and
data fill be reported immediately and RX will be disabled. Driver
was not ready for that and was expecting to have non-null RX buffer
during RX enabling. Added additional check which returns from RX
enabling function with success if RX is disabled.

Signed-off-by: Krzysztof Chruściński <[email protected]>
If RX was disabled from flushing (because there is more bytes from
FIFO then input buffer) then another enabling might have been called
from the context of RX disable event. In that case, driver was faulting
because it was in the middle of enabling when another enabling was
happening.

Signed-off-by: Krzysztof Chruściński <[email protected]>
When user is aborting RX then it means that there is no intrest
in any remaining data. In that case RX FIFO content shall be
dropped and not prepended to the next RX buffer provided when
receiver is reenabled.

Minor tweak in workaround in RX FIFO flushing. If amount value
is bigger than the RX FIFO size that indicates that FIFO was
empty.

Signed-off-by: Krzysztof Chruściński <[email protected]>
Switch buffers before calling user handler. This way if user sets
new buffer from the context of RX done handler it can be configured
as next (or current one).

Signed-off-by: Krzysztof Chruściński <[email protected]>
Before handling given event in the interrupt handler check if interrupt
for that event is enabled. It is possible that interrupt is triggered
by different event and in that case handling an event may lead to
unexpected behavior.

Signed-off-by: Krzysztof Chruściński <[email protected]>
Do not share cache buffers space with RX fifo buffer as both may be
used at the same time.

Signed-off-by: Krzysztof Chruściński <[email protected]>
Move static function up in the code so it can be used in functions
following the new location.

Signed-off-by: Krzysztof Chruściński <[email protected]>
When RX flushed data is enough to fill the new buffer then RX DONE
event shall be called to the user. However, wrong function was
called, the one that did not take into account handling of RX cache
(bounce buffers).

Signed-off-by: Krzysztof Chruściński <[email protected]>
Function was returning wrong value when peripheral was disabled. This lead
to failures of nrfx_uarte_rx in blocking mode.

Signed-off-by: Krzysztof Chruściński <[email protected]>
Getting next length of RX cache buffer was wrong in case when
there was no user buffer pending as user buffer was not taken
into account when calculating the new length.

Signed-off-by: Krzysztof Chruściński <[email protected]>
Fix 2 race conditions:
- rxstarted event being handled twice
- setting new buffer when RX is disabled

Signed-off-by: Krzysztof Chruściński <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant