cancel
Showing results for 
Search instead for 
Did you mean: 

Why does SPI communication with DMA in STM32H745ZI (NUC-H745ZI) using example code is giving varying output?

Mr. AK
Associate III

Hi, I'm using the NUCLEO-H745ZIQ device, and I'm starting with SPI. I used the "SPI Full Duplex communication with DMA example code" in the repository available from "st" (STM32Cube_FW_H7_V1.10.0 folder). It is giving me the expected output but sometimes not.

Expected output is Green LED and Yellow LED must turn ON on pressing USER_BTN and this is happening sometimes but after a while the same code with same circuit is giving a wrong output i.e., Yellow LED and Red LED ON on button press.On debug, it seems to work but here also we cannot predict whether it'll work or not.

Please tell me why it is having random behavior.

Thank you

2 REPLIES 2

For DMA issues on the H7 watch for the addresses used for the buffers and cache coherency. ​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Mr. AK
Associate III

hi,

Thank you for the reply. I'm going through the concepts of cache coherence. Meanwhile, I'm also implementing SPI with pollling.

I used the HAL_SPI_TransmitReceive() function in CM7 and CM4 (CM7-> full duplex Master & CM4 -> full duplex slave, Motorola, 8 bit, MSB first) but I'm getting error. I've tried debugging the code and I can see that the CM7 is Transmitting sucessfully (0x40013014-> SPI1_SR is updating values in the expected manner) but receiving is not occuring. In CM4, no Tx and Rx happening.

The RXP of both SPIs (CM7->SPI1 & CM4 -> SPI4) are not set.

So, do cache coherence matter for SPI through polling like it does for DMA.

please answer