-
Notifications
You must be signed in to change notification settings - Fork 1.8k
platform: stm32: fix SPI DMA timeout underflow #3116
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -672,16 +672,18 @@ int32_t stm32_spi_transfer_dma(struct no_os_spi_desc* desc, | |
| sdesc->stm32_spi_dma_done = false; | ||
| stm32_config_dma_and_start(desc, msgs, len, stm32_spi_dma_callback, desc); | ||
| timeout = msgs->bytes_number; | ||
| while (timeout--) { | ||
| while (timeout > 0) { | ||
| no_os_mdelay(1); | ||
| if (sdesc->stm32_spi_dma_done) | ||
| break; | ||
| timeout--; | ||
| }; | ||
|
|
||
| /* need some cleanup here? */ | ||
| if (timeout == 0) | ||
| /* Fix: Check the actual completion flag instead of the counter */ | ||
| if (!sdesc->stm32_spi_dma_done) { | ||
| /* Optional: Add HAL_DMA_Abort_IT() or similar cleanup here */ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this comment as well
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i reverted to the original comment
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, just squash the commits for now into a single commit and leave the original question there. We can deal with that separately in another PR and merge this one. |
||
| return -ETIME; | ||
|
|
||
| } | ||
| return 0; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.