cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 Simple SPI Rx does not work

Gabriel T
Senior

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 ?

1 ACCEPTED SOLUTION

Accepted Solutions
Gabriel T
Senior

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

0693W000007BzaFQAS.png

View solution in original post

5 REPLIES 5
Gabriel T
Senior

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
Senior

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

0693W000007BzaFQAS.png

TDK
Guru

> 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
Senior

@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

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".