2024-12-29 03:45 PM
Hello to all developers!)
I am interested in the following question: is it possible to use the pins of the STM32G031J6M6 microcontroller first for programming (SWCLK, SWDIO), and then for another functionality, for example for UART?
Maybe there is some separate programming mode and a separate functional mode? Or for example, do I need to use Reset to perform programming? I know that the PIC10 microcontroller uses the same pins for programming and performing functions.
I would be grateful for the answer!!!
2024-12-29 04:38 PM
It's going to get ugly.
If you don't commit a pin the NRST, you'll either need to power cycle the part, or facilitate it reseting via some user interface or user interaction via your UART
I might suggest putting an idle loop in Reset_Handler to burn a few hundred thousand cycles to allow time for the debugger to probe/connect out of power-up/reset before you get to main() and reconfigure the SWDIO/SWCLK to alternate functionality or different bond-out pin usage.
2024-12-29 04:49 PM
Sorry, I don't fully understand what you're saying.
2024-12-29 05:07 PM
Which part?
That the interaction of the debug probe needs the pins to be in/available for SWDIO/SWCLK? That there is quite a significant time window needed from the part starting to you reconfiguring the pin usage/function in order to wrestle control? That gets more complicated if it can't control the process via "Connect Under Reset" where it would normally try to reset and then try to initiate the debug sequence?
Perhaps start by forumlating and communicating how you plan to use the very limited pin count.
You'd need to have SWDIO/SWCLK to be usable in a manner that doesn't conflict with other board function whilst the debugger is connected.
Some reason the smaller UFQFPN28 couldn't be used?
https://www.st.com/resource/en/datasheet/stm32g031j6.pdf
2024-12-30 05:20 PM
> is it possible to use the pins of the STM32G031J6M6 microcontroller first for programming (SWCLK, SWDIO), and then for another functionality, for example for UART?
Yes, this is possible. However, if the pins are defined as UART you will be unable to connect over SWD. This also means debugging with SWD will not be possible. Ensure you are able to enter the bootloader or recover the chip in some other manner. Inserting a 1sec delay on startup before re-assigning the pins can work, if you are quick with connecting.