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

Fix for long length SPI writes on ATMEL #7673

Merged
merged 1 commit into from
Mar 4, 2023

Conversation

gamblor21
Copy link
Member

@gamblor21 gamblor21 commented Mar 3, 2023

Fixes #7670

Writes over 64Kb were failing as that is the maximum a DMA write can handle.

Possible other fix would involve chaining DMA transaction buffers but the break between buffers was about 3 microseconds so probably not an issue.

This could be moved into dma.c but then would have to be careful about QSPI (which has this problem but at 4x the size). This was the easier place to put it in, but open if we want to modify it too. It seems only SPI/QSPI uses the routine in question.

@tannewt tannewt requested a review from jepler March 3, 2023 21:45
Copy link
Member

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty safe, though I notice that for (say) a transfer of 65536+16 bytes it will do a DMA transfer of the final 16 bytes. This is probably just fine, I think avoiding DMA for small transfers is just for efficiency, not correctness. Didn't test, would love to hear from @gamblor21 before merging if this fixes the original problem

@jepler
Copy link
Member

jepler commented Mar 4, 2023

oh wait, you filed the PR. I'm apparently not far enough into this mug of coffee yet :)

@jepler jepler merged commit 4e169bb into adafruit:main Mar 4, 2023
Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment.

ports/atmel-samd/common-hal/busio/SPI.c Show resolved Hide resolved
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.

ATMEL M4 SPI transfer size truncated
3 participants