Skip to main content
Visitor II
August 9, 2024
Question

Automatic SPI communication using STM32U5

  • August 9, 2024
  • 2 replies
  • 1119 views

Hi

I use STM32U575I-EV.

I want to periodically read data from an external SPI device without CPU.

The SPI device will emit a data ready signal(active low gpio), so I want to use that as a trigger to read the data.

Ideally, I would like to perform multiple SPI receptions while keeping the CPU in Stop mode.

To read data from a SPI device, just do something like HAL_SPI_Receive_DMA().

 

Are there any good example projects ?

Or how can I do this ?

I read this articles, but it didn't solve my problem.

Solved: STM32U5 SPI Continuous Communication - STMicroelectronics Community

Best regards.

    This topic has been closed for replies.

    2 replies

    Technical Moderator
    August 9, 2024

    Hi @DK3 ,

    I believe that the LPBAM is the good solution for your case.

    To know more about the LPBAM, please refer to the wiki article Getting started with LPBAM.

    As stated there, a typical example is provided in STM32Cube\Repository\STM32Cube_FW_U5\Projects\NUCLEO-U575ZI-Q\Applications\LPBAM\LPBAM_SPI_TransmitReceive. You can check the readme file to understand more the example.

    -Amel

    DK3Author
    Visitor II
    August 13, 2024

    Hi, @Amel NASRI 

    Thanks to your advices, I was able to do SPI read automatically.

    I want to generate a DMA interrupt once every two times and use the receive buffer continuously.

    (e.g. Receive1 uses RxBuff[0] ~ RxBuff[7], Receive2 uses RxBuff[8] ~ RxBuff[15])

    So, I created two SPI_Receives as shown in the attached image and configured "Transfer Event Generation" as follows.

    Receive1 : Transfer Event Generation = TC and HT generated on the last linked-list item

    Receive2 : Transfer Event Generation = TC and HT generated on each block

    DK3_0-1723540839321.png

    This worked as intended. 

    Is this setting correct ? Is there a better way ?

    When I set Transfer Event Generation of Receive1 and Receive2 to TC and HT generated on the last linked-list item, DMA interrupt was not generated.

    The latter setting seemed like the correct setting, but it didn't work.

    Please tell me that reason.

    Best regards.