2025-08-25 8:18 PM
Hello. I'm trying to configure the STM32C011J4M6 to output SPI in Transmit Only Master mode. However, as soon as I turn on SPI in STM32CubeIDE and program it, the uC stops behaving properly. I can't transmit any data and the clock pin stays high with periodic spikes down to ground. My best guess is that this has something to do with the clock pin being assigned to the reset pin.
I'm able to program it to toggle GPIO separately, but as soon as I try to change the reset pin to a GPIO, all the GPIO stop toggling and the reset pin does the high with spikes thing. That seems to point to this being a "reassign the reset pin" issue than a SPI issue.
Is CubeMX just not disabling the reset pin properly? I don't have anything connected to the uC except the programming SWD clock and data lines, as well as the reset line connected to the programmer.
I've never tried to repurpose the reset pin before, but I can't imagine ST would add an unusable SPI peripheral.
The only changes I've made to main.c are according to the ST Tutorial. The only changes I made in CubeMX were to turn on SPI in Transmit Only Master mode, and to turn on Serial Wire in DEBUG.
Any advice on how to fix this? I've attached the whole workspace folder in case it's useful.
Solved! Go to Solution.
2025-08-26 4:25 AM
You need to change option bytes using STM32CubeProgrammer such that the NRST pin doesn't reset the device.
2025-08-26 4:25 AM
You need to change option bytes using STM32CubeProgrammer such that the NRST pin doesn't reset the device.
2025-08-26 8:04 AM
Thanks for the help! Is there a way to change those bits in firmware with a C/C++ command in STM32CubeIDE, so that they're changed during normal programming?
2025-08-27 7:44 PM
For anyone with this same issue, in STM32CubeProgrammer,in the top right, there's a blue drop down menu. Select ST-LINK (if using that to connect to your device) and click the green connect button. The log should show test indicating a connection was made.
Click on the OB tab on the left. Under user configuration, scroll down to NRST_MODE. In the drop down menu, select 2. Then click the apply button. You should get a message that says "Option Bytes successfully programmed".
That's as far as I've gotten, but I assume the reset pin should be able to be used for other functions now.