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

tests.drivers.spi_loopback stm32wb55x transfer multiple buffers with dma #25244

Merged
merged 2 commits into from
May 13, 2020

Conversation

FRASTM
Copy link
Collaborator

@FRASTM FRASTM commented May 12, 2020

The spi test application is transferring several buffers and check that Rx one equals Tx one.

In this configuration of the stm32wb It is using the dma communication capability of the SPI feature.
In transmission mode, when the DMA has written all the data to be transmitted (the TCIF
flag is set in the DMA_ISR register), the BSY flag can be monitored to ensure that the SPI
communication is complete.
This is done waiting for the SPI BUSY flag before considering the DMA Tx and Rx completion flags. The DMA callback function, based on the DMA channel irq, will set "a end of transfer" flag.
The main SPI client transfer loop will then switch the Tx/Rx buffers when both Rx and Tx are completed.

Refer to the Data transmission and reception procedures of the SPI feature in the Ref Manual.

Fix #25241

@zephyrbot
Copy link
Collaborator

zephyrbot commented May 12, 2020

All checks are passing now.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

@erwango erwango added platform: STM32 ST Micro STM32 area: DMA Direct Memory Access bug The issue is a bug, or the PR is fixing a bug labels May 12, 2020
@erwango erwango added this to the v2.3.0 milestone May 12, 2020
Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

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

I'm fine with the change, but please rebase first as the 3 first commits are already in tree

FRASTM added 2 commits May 13, 2020 09:23
This change avoids the reload of the dma channel
in the callback function, just sets the corresponding Tx, Rx flag.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
With this change, the spi transceive with dma function
waits for the spi busy flag reset and for the dma transfer end.
Then it reloads the channels until all buffers are consumed.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
@FRASTM
Copy link
Collaborator Author

FRASTM commented May 13, 2020

rebased

@carlescufi carlescufi merged commit 1a16367 into zephyrproject-rtos:master May 13, 2020
@erwango erwango added the priority: medium Medium impact/importance bug label May 13, 2020
@FRASTM FRASTM deleted the issue-25241 branch August 16, 2022 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: DMA Direct Memory Access area: SPI SPI bus bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tests.drivers.spi_loopback stm32wb55x fails transfering multiple buffers with dma
4 participants