-
Notifications
You must be signed in to change notification settings - Fork 118
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
nordic-krch
wants to merge
11
commits into
zephyrproject-rtos:master
Choose a base branch
from
nordic-krch:uarte_rx_en_race
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
nrfx: nrfx_uarte: Various fixes #187
nordic-krch
wants to merge
11
commits into
zephyrproject-rtos:master
from
nordic-krch:uarte_rx_en_race
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <krzysztof.chruscinski@nordicsemi.no>
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 <krzysztof.chruscinski@nordicsemi.no>
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 <krzysztof.chruscinski@nordicsemi.no>
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 <krzysztof.chruscinski@nordicsemi.no>
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 <krzysztof.chruscinski@nordicsemi.no>
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 <krzysztof.chruscinski@nordicsemi.no>
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 <krzysztof.chruscinski@nordicsemi.no>
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 <krzysztof.chruscinski@nordicsemi.no>
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 <krzysztof.chruscinski@nordicsemi.no>
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 <krzysztof.chruscinski@nordicsemi.no>
Fix 2 race conditions: - rxstarted event being handled twice - setting new buffer when RX is disabled Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Various fixes for bugs found after adding a stress test.