-
I am working on a custom board based on H563vit6, using the variant STM32H5xx/H563V(G-I)T_H573VIT. I need to sample data from ADCs using three SPI peripherals I am managing my own NSS pins Only SPI4 is working as configured. With SPI1 and SPI3, the MCU hangs on SPI.transfer() Using stm32Cube to configure the same SPI peripherals on these same pins, I was able to use simple HAL_SPI_Transmit() calls to verify that NSS, SCLK, MOSI are correctly working for SPI1 and SP3 (probed those lines with logic analyzer). So the issue seems to be with instantiating SPI1 and SPI3 in Arduino. I am using platformio. The relevant variant files are in .platformio/packages/framework-arduinoststm32/variants/STM32H5xx/H563V(G-I)T_H573VIT. In PeripheralPins.c I see the "WEAK const PinMap PinMap_SPI_*[]" lines. They seems to have the correct entries to match the SPI pins and their AF. In variant_generic.h I have tried commenting out the PIN_SPI_* default defines, corrected PIN_SERIAL_RX, PIN_SERIAL_TX to match the UART4 on my board, and deleted many unused peripherals (DAC, I2C, etc.). Could you please advise what I might be missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @georgedlu |
Beta Was this translation helpful? Give feedback.
Thanks! It was indeed the clock config. I followed the instruction on https://github.com/stm32duino/Arduino_Core_STM32/wiki/Add-a-new-variant-(board). From the stm32cube project I copied over the relevant lines in SystemClock_Config() and HAL_SPI_MspInit() into generic_clock.c. That did it.