2021-11-11 05:17 AM
I am trying to communicate with an SD card using SPI.
I have found a library, that can work on an STM32g031f6, but if I try to do the same on an STM32g030j6, it crashes/resets when it calls the function "__HAL_SPI_ENABLE" in "stm32g0xx_hal_spi.c".
I have attached an image of the wiring, normally I would use PA13 fo SD_CS, but I have changed it to PC14, so I can debug the chip.
Solved! Go to Solution.
2021-11-11 08:52 AM
You have SPI_SCK going on the NRST pin. When it sets the clock low, it pulls NRST down and resets the chip. You need to leave that pin alone per the datasheet:
You can also disable the NRST functionality at your own peril, even though it's not a supported feature on this chip. Note that this is a good gateway towards bricking your chip.
2021-11-11 05:21 AM
Read out the RCC->CSR registers to determine the cause of the reset. Monitor the voltage rail to ensure power isn't lost. Ensure watchdogs are disabled.
The STM32G030 and the STM32G031 have the same SPI peripheral, so the answer lies elsewhere. Probably in the hardware.
2021-11-11 05:47 AM
2021-11-11 08:52 AM
You have SPI_SCK going on the NRST pin. When it sets the clock low, it pulls NRST down and resets the chip. You need to leave that pin alone per the datasheet:
You can also disable the NRST functionality at your own peril, even though it's not a supported feature on this chip. Note that this is a good gateway towards bricking your chip.
2021-11-12 01:40 AM
I am unable to use other pins for the SPI configuration, as both SPI 1&2 needs pin 8, but I will try and see if I can disable the reset pin.