Skip to main content
Gabriel T
Senior
January 20, 2021
Solved

STM32H7 Simple SPI Rx does not work

  • January 20, 2021
  • 5 replies
  • 1999 views

Hello,

I am using SPI1 on STM32H743ZI MCU.

When I use SPI Transmit Function it works well.

But when I use :

HAL_SPI_Receive(&hspi1, ads_buf, READBACK_LENGTH,500);

ads_buf is still full of 0, it does not get filled

I checked with logic analyser and it is working fine :

0693W000007ByPuQAK.pngI am using DTCMRAM but I tried to move to RAMD1 and the problem is still there

Any ideas how to solve this ?

This topic has been closed for replies.
Best answer by Gabriel T

Fixed by modifing HAL lib with this : Void_Buffer is a buffer I fill with 0 at init

0693W000007BzaFQAS.png

5 replies

Gabriel T
Gabriel TAuthor
Senior
January 20, 2021

When I switch from Half-Duplex to Full-Duplex the reading works but I want to use Half duplex since Full is making my slave crash / reset. I think my slave is bugging because the HAL SPI lib echoes the message. Is there any simple way to "mute" MOSI, it is very annoying that Full Duplex HAL lib can't work without transmitting data. Calling the Transmit_Receive function that needs a Tx ptr to work :face_with_tears_of_joy: .

Gabriel T
Gabriel TAuthorBest answer
Senior
January 20, 2021

Fixed by modifing HAL lib with this : Void_Buffer is a buffer I fill with 0 at init

0693W000007BzaFQAS.png

TDK
January 20, 2021

> Is there any simple way to "mute" MOSI, 

You can de-initialize the MOSI pin if you don't want a signal on it.

By setting the buffer to zeros, you're still sending data.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Gabriel T
Gabriel TAuthor
Senior
January 21, 2021

@TDK​  Just to be sure, when you mean de-initialize, I set MOSI as analog in ?

About the buffer, I am technically still sending data but only zeros means the line stays at low level

TDK
January 21, 2021
Or digital in, or digital out, or anything except the SPI AF function.
If you just want to send zeroes, I would use HAL_SPI_TransmitReceive instead with a zeroed buffer.
"If you feel a post has answered your question, please click ""Accept as Solution""."