EEVblog Electronics Community Forum

Computing => Embedded Computing => Topic started by: Dubbie on March 15, 2021, 11:57:44 pm

Title: STM32G0 SO8N
Post by: Dubbie on March 15, 2021, 11:57:44 pm
Has anyone here used this part?
I was wondering how it works if you want to use SWD. Does that knock out 2 pins or is it easy to use them dual purpose? Do you need to use the reset pin for programming?

I was hoping to use them as a replacement for ATiny85's. I currently have those in a drawer for when I need a quick one off MCU for some sort of basic task like timing, counting or something.

I wanted to switch to STM32 so I don't have to maintain 2 toolchains and 2 HALs in my head :D
Title: Re: STM32G0 SO8N
Post by: ataradov on March 16, 2021, 12:31:14 am
On reset SWD pins are assigned as a programming interface, but the firmware may disable them and then they can be used as standard GPIO pins. Your circuitry attached to the pins must be compatible with SWD. In practice it means that it should not have anything that would pull them strongly high or low.

You don't really need a reset, but if the firmware switches off SWD pins immediately, it may be tricky to reprogram the part without a reset pin.
Title: Re: STM32G0 SO8N
Post by: Dubbie on March 16, 2021, 12:36:56 am
So maybe a 1 second delay or something before configuring the reset as GPIO should do the trick? And then remove power and connect with SWD hardware attached?
Title: Re: STM32G0 SO8N
Post by: ataradov on March 16, 2021, 12:46:31 am
Yes, at least for prototyping, delay reconfiguration of system pins and going into low power modes.

Having SWD hardware attached will not do anything, since the software must run and be able to intercept execution. ST devices will let debugger connect to the core while reset is asserted. So asserting the reset while power cycling should recover the device from any state, but the programmer/debugger software must support this.

So generally it is better to reuse SWD pins first and leave the reset to be the last pin reassigned as GPIO, since in that case you would not need to power cycle the device to enable SWD pins.
Title: Re: STM32G0 SO8N
Post by: Dubbie on March 16, 2021, 04:25:50 am
Thanks ataradov. Very helpful info.