2025-05-19 4:57 AM
Hi,
I am accessing a DRV8873s motor driver (SPI version) on two different NUCLEO boards. My usage is limited to reading data from 2 registries.
I got it to work on a NUCLEO-STM32F411RE using SPI2, with the following settings:
Motorola format, 8 bits, MSB first, prescaler 32 to get a 1.5625 Mbits/s rate, CPOL = low and CPHA = 2Edge.Now I try to do the same with a NUCLEO-STM32F767ZI and the same code and configuration (apart from the baud rate, set to 1.6875 MHz) don't work anymore.
I have tried SPI4 and SPI5 on this board with the same result: the data read by HAL_SPI_TransmitReceive is not correct.
Is there a difference in the way STM32F4 and STM32F7 perform SPI communication, or in the electronics?
2025-05-19 5:05 AM
Welcome to the forum.
Please see How to write your question to maximize your chances to find a solution for best results.
@RH38 wrote:I got it to work on a NUCLEO-STM32F411RE using SPI2 ... with a NUCLEO-STM32F767ZI and the same code and configuration (apart from the baud rate, set to 1.6875 MHz) don't work anymore.
Have you used an oscilloscope and/or logic analyser to see what (if anything) is happening on the wires?
Have you tried a basic SPI example for the F7 board?
2025-05-19 5:10 AM
The peripherals are different but the abstracted HAL_SPI_TransmitReceive call is the same for both. Show your code. Probably something else going on.
2025-05-19 5:39 AM
Thanks for the reply
first point: I have no instrument to see if the signals are correct or not. If the default persists I'll have to spy these signals with another card (I have several)
second point: I am currently studying the F7 example for SPI in polling mode, and I can't find any difference with what I (think I) do. I am going to try a basic communication between two cards for a start.
I keep on trying!
2025-05-19 5:48 AM
Thanks for the reply
Yes, this is why I prefer using HAL functions; btw the same code runs on a G474RE board as well. As my project is rather complex, it is probably a good idea that I restart from scratch with just this SPI comm to eliminate side effects