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

nrf52: SPI transfer failure and corruption #1777

Merged
merged 1 commit into from Sep 14, 2020

Conversation

btashton
Copy link
Contributor

Summary

The current EasyDMA implementation will fail if a transfer of over
255 bytes is requested with no warning.

Also we do not set the RX and TX transfer lengths to 0 if the
buffer is NULL which can cause data to be written to the old
address as well as cause unexpected transaction lengths.

Example:

transfer 1:

   rx_len  = 10
   rx_buff != NULL
   tx_len  = 10
   tx_buff != NULL

transfer 2:

   rx_len = 2
   rx_buff != NULL
   tx_buff == NULL

Total transaction length for the second would be 10 because it would still be using the old tx length of 10 and would send the data in that buffer out.

Impact

SPI transactions should be safer. And warnings are given when transactions are too long.

Testing

Driving a SPI display.

The current EasyDMA implementation will fail if a transfer of over
255 bytes is requested with no warning.

Also we do not set the RX and TX transfer lengths to 0 if the
buffer is NULL which can cause data to be written to the old
address as well as cause unexpected transaction lenghts.
Example:
  transfer 1:
   rx_len  = 10
   rx_buff != NULL
   tx_len  = 10
   tx_buff != NULL
  transfer 2:
   rx_len = 2
   rx_buff != NULL
   tx_buff == NULL
  Total transaction length for the second would be 10 because it
  would still be using the old rx length of 10 and would
  corrupt data in the old rx buffer.

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
@raiden00pl raiden00pl merged commit 93eeecf into apache:master Sep 14, 2020
@btashton btashton added this to To-Add in Release Notes - 10.0.0 Oct 14, 2020
@btashton btashton moved this from To-Add to Added in Release Notes - 10.0.0 Oct 18, 2020
@btashton btashton deleted the nrf_spim branch December 30, 2020 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants