cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 STM32F4 spi

VYoun
Associate III

Hello,

I am trying to use an ADC (AD7124) which is communicating through SPI with the MCU.

Previously, I managed to run the ADC with STM32F4. For this I used the libraries provided by the ADC manufacturer.

While the ADC is running prefectly with STM32F4, it does not run with STM32H7.

When running with STM32H7, I get a timeout error from the ADC.

I realize that the SPI in STM32H7 has many more parameters comparing to the STM32F4 SPI.

Is it possible that I should make some extra settings in the STM32H7 spi?

Please help me if you can, I am relatively new to this field, and I really need this for my work.

Any help is greatly appreciated.

Thank you and best regards,

Vouria

2 REPLIES 2
PMath.4
Senior III

Use CubeMX and setup a dummy project for the H7. Configure SPI in the project, both SPI itself and the SPI clock and generate the code. Then cut and paste the SPI setup from main.c, stm32h7xx_hal_msp.c and if applicable stm32h7xx_it.c into your code. In main.c don't forget the clock setup.

Despite others comments I have found CubeMX works superbly for the H7 and you can pretty much guarantee that it will generate working code

VYoun
Associate III

Hello,

Thank you very much. I have setup a simple program with only USART and SPI, which reads some data from SPI and sends it to USART, and it worked.

I am really relieved.

Problem is that the SPI on stm32h7 has many parameters, which do not exist in stm32f4. And I was thinking I need to set these parameters up.

Best regards,

Vouria