Skip to main content
Associate II
July 6, 2023
Question

How to use 'HAL_SPI_TransmitReceive_DMA' & 'HAL_SPI_Transmit_DMA' for spi, but error in 'devID'

  • July 6, 2023
  • 3 replies
  • 8488 views

i'm using 'HAL_SPI_TransmitReceive_DMA' , but error in 'devid'

'HAL_SPI_TransmitReceive_DMA'  -> The path to use this function is

kim_dy_0-1688604723751.png

kim_dy_1-1688605009400.png

kim_dy_2-1688605029020.png

kim_dy_3-1688605113687.png

 

kim_dy_4-1688605178758.png

kim_dy_5-1688605226133.png

If I use the commented 'HAL_SPI_TransmitReceive' function, the 'devID' value is 0xdeca0310 (normal value)
If you use the 'HAL_SPI_TransmitReceive_DMA' function, the 'devID' value comes out as 0x0(error).

DMA settings are as follows.

kim_dy_6-1688605424895.png

I must solve this problem/
Let me know if there is any information you need to solve the problem.

This topic has been closed for replies.

3 replies

TDK
July 6, 2023

HAL_SPI_TransmitReceive_DMA starts a transmission which runs in the background. You need to wait for it to complete before you can pull up the CS pin and read the data.

"If you feel a post has answered your question, please click ""Accept as Solution""."
kim_dyAuthor
Associate II
July 10, 2023

I'm sorry, but what CS pin are you talking about?

Andrew Neil
Super User
February 21, 2024

@kim_dy wrote:

I'm sorry, but what CS pin are you talking about?


"CS" = "Chip Select"

AndrewNeil_1-1708510800361.png

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate
February 21, 2024

Lachezar_0-1708507458430.png

Wait DMA to finish before you set NSS(CS) pin. 

Andrew Neil
Super User
February 21, 2024

Please use this button to properly post source code - not as images:

AndrewNeil_0-1708510610942.png

 

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.