cpu/nrf52840: fix UART DMA when data is in ROM#11170
Merged
jcarrano merged 1 commit intoRIOT-OS:masterfrom Mar 13, 2019
Merged
Conversation
jcarrano
approved these changes
Mar 13, 2019
| * So if the given `data` buffer resides in ROM, we need to copy it to RAM | ||
| * before being able to transfer it. To make sure the stack does not | ||
| * overflow, we do this chunk-wise. */ | ||
| if (!((uint32_t)data & RAM_MASK)) { |
Contributor
There was a problem hiding this comment.
Suggested change
| if (!((uint32_t)data & RAM_MASK)) { | |
| if (!((intptr_t)data & RAM_MASK)) { |
This file contains hidden or 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
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.
Contribution description
When testing #11096, we discovered a bug in the
nrf5240s uart implementation: Nordic'sEasyDMAis only capable of transferring data from RAM, but not from ROM. So whenever passing a ROM location to the UART driver (e.g. someconst char *), the UART would only transfer0x00bytes. This made e.g.tests/fmt_printfail for all targets using thenrf5280cpu.This PR fixes this issue by chunk-wise copying the TX data into RAM before sending it in case the data is coming from ROM.
Testing procedure
Run e.g. the
tests/fmt_printtest on thenrf52840dkor thereelor similar. Without this PR the test will fail, with this PR it will succeed.Issues/PRs references
issue found in #11096