Default pin states on unprogrammed STM32G030F6P6 - Page 1
Forum section: electronics / general

author: CaptainBucko
author_rank: Regular Contributor
timestamp: June 14, 2024, 04:59:11 am
content: Hi Guys,I don't have much MCU experience, so maybe someone here can provide some guidance/help/abuse.....I have been building a short circuit tester from JDobryhttps://www.eevblog.com/forum/testgear/finding-short-on-motherboards-with-a-shorty-(with-display)/msg4304386/#msg4304386using his PCB design and schematic (see below) + BOM (sourced from LCSC).Official Pages:https://gitlab.com/jdobry/shortypen/https://oshwlab.com/jdobry/shortypenI fitted supporting components for the MCU including the 3v3 switcher (U2) and the unprogrammed STM32G030 (U5), but noticed I have what I think is an excessive current draw (60mA). I removed the MCU and all unnecessary components, and current dropped to 50uA which is expected from my calculations from the schematic and components left fitted. I have 3 MCUs, so I re-soldered the 2nd one, and its the same 60mA current consumption.I have a Chinese ST-LinkV2, and it can't detect the MCU. So I thought I should try and understand what the default states of the MCU pins might be on 3v3 power up in an unprogrammed state.So, I thought I should first try and understand what the default states of the IO pins are on a powered but unprogrammed MCU, and then confirm that with a DMM. However, this is where I an confused.The MCUhttps://www.st.com/resource/en/datasheet/stm32g030f6.pdftalks about default states upon reset (ie: PAx is set to analog inputs).I then found AN2606 on the Boot Modehttps://www.st.com/resource/en/application_note/an2606-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdfwhere on pp209 describes that in boot mode, certain peripherals are enabled (SPI, UART1, UART2) and maybe one of the enabled outputs on those peripherals corresponds to one of the PAx pins that are grounded in this design (as per the schematic, PA0, PA1, PA7, PA11 are grounded), and maybe the excess current are outputs trying to go high on a ground connection.JDobry talks about programming the MCU with battery or via ST-Link, but on my Chinese clone the 3v3 supply drops to 2v at the 60mA current draw of this MCU, and I cant get it to connect. It does have the 20cm long wires, and I have seen references to cut these down to 5cm to make it reliable, so I will try that.I am building up a second PCB, and I will solder my 3rd and last MCU onto this to cross-check. I need to order some 1.85v LDOs (U1) from Digikey as I sourced the wrong part from LCSC, so I am going to order more MCUs, and I'll choose one of the NUCLEO dev boards.My only "left brain" thought last night is that I might have fried some IO pins electrically when soldering. It turns out my Microscope was powered via a UPS sourced 240v outlet, and my soldering iron was not, and was not grounded, and I measured 16v AC on my DMM between microscope base plate earth to soldering iron tip. This will be very low leakage, but I did find a reference to someone else who made the same mistakehttps://electronics.stackexchange.com/a/447300although the outcome was catastrophic.I have built many MCU projects before, I am confident of my soldering skills and everything has been electrically tested with two DMMs. I will unbox the DSO and check the 3v3 is stable and not overshooting or noisy.Anyway, I thought someone might know what the default IO states of this MCU might be when unprogrammed but powered, and if I can confirm that I will have some confidence to load the last MCU on the 2nd board and keep trying. For some reason, this project just wont give up without a damn good fight. Funny how that happens every now and again.Tnx

author: Doctorandus_P
author_rank: Super Contributor
timestamp: June 14, 2024, 05:50:26 am
content: Quote from: CaptainBucko on June 14, 2024, 04:59:11 amHow many of those do you have?Have you tried swapping it with another one?I have a bunch of those, and they tend to have "varying insides", with different brands and models of cloned / copied chips. I already have these for quite some years, and a few years ago the price of the ST-Link V3 from ST itself (Buy from Mouser, digikey, TME, etc) has become below EUR10 and If I had any problems with my chinese versions, I'd just buy a few real ones from ST themselves. Last time I tried to use one of the chinese dongles, it got "recognized" by STM32Cube and it updated it's firmware and still worked afterward.I do like the form factor of these chinese things. If you want to look inside, you can just pull off the aluminum shell. But also beware, the signals on the 10 pin programming connector are not always the same between these things.For the "default configuration", if you look in the reference manual, then you should see the "reset values" for all important registers.

author: CaptainBucko
author_rank: Regular Contributor
timestamp: June 14, 2024, 06:27:22 am
content: Quote from: Doctorandus_P on June 14, 2024, 05:50:26 amI have only one. It is detected correctly with the STM32CubeProgrammer and I upgraded its firmware to the latest version successfully. When I get the Rigol fired up tonight, I will probe SWCLK and SWDIO to see what is happening. But given I am going to put an order in for Digikey, I will order a genuine ST-Link V3 from them, as this is not worth my time second guessing now.

author: pcprogrammer
author_rank: Super Contributor
timestamp: June 14, 2024, 05:19:29 pm
content: Sounds more like some other problem than the Chinese ST-link not working.The current drawn by the MCU is to high for a blank one, even if it would be in it's bootloader, which it only enters under certain conditions specified in the app note you linked to. See page 31, pattern 11 for the conditions.Might be helpful for better insight if you post some close ups of the board with and without the MCU soldered.

author: xvr
author_rank: Frequent Contributor
timestamp: June 14, 2024, 06:27:25 pm
content: AFAIK boot loader in STM32 use all possible boot sources in 'slave' mode. It will not try to send anything to anywhere, it just turn all appropriate pins to input mode and listen. It not set anything as output (however I could be wrong).60mA definitely too much for blank CPU.QuoteTry to remove only CPU - some of 'unnecessary' components can be in short cut (power blocking capacitor, for example)

author: CaptainBucko
author_rank: Regular Contributor
timestamp: June 16, 2024, 01:09:34 am
content: Thanks for the ideas. I soldered the #3 CPU onto the 2nd PCB, and the current is now 200uA (instead of 60mA) on enabling 3v3! I have not tried to program it yet with the ST-Link, but I solved the major problem, so I get to keep moving forward.The root cause of my problem was a ground differential between the soldering iron and metal base plate of the microscope. Stupidly I was powering one via a UPS and the other directly, and I measured a 16v AC ground difference. Must have been enough to blow up some of the input pins. I re-organised the powering all items to come off one common power board, I ground the soldering iron (it has a ground port), and I ground myself using an anti-static wrist strap via 1Meg resistor.I've soldered a lot of MCUs in my life, but I have never blown some up do to an issue like this. Just goes to show there is also something to learn, and something to be aware of. In my scenario, I put all my tools away for a few years and this is the first time I had set up soldering at my desk inside.

author: CaptainBucko
author_rank: Regular Contributor
timestamp: June 17, 2024, 07:04:02 am
content: Final update - I did get the Chinese clone ST Link V2 to communicate. I was having some difficulties at first, but then worked out the plastic arrow embossed on the 2x5 Way header did not actually indicate Pin 1. So once I found the correct pin-out, it worked fine. It also explained why I was still not seeing 3v3 but 2v on the supply line, because it was not a power output of course!