STM32L412 some GPIOs default to Output mode with blank flash
Hi,
This can be considered as a bug / something to be improved on the ROM bootloaders (at least in the L412 family):
Our specific design uses TIM16_CH1 in PWM mode to control a small flyback converter. As a safety measure, we've added a pull-down to this line, so nothing bad will happen before the application firmware takes control, configures the GPIO as output and ensures a safe duty-cycle for this signal...
The issue comes when the device is powered-on for the first time: As the Flash is blank, the ROM bootloader kicks-in, which is a handy feature, but then this GPIO is set as an output, with a High-level, therefore overriding the safety pull-down resistor. This causes our flyback converter to operate out of the safe range and therefore being destroyed.
We've nailed down the issue to the bootloader configuring the SPI1 in slave mode, that for our specific GPIO (PA6) is the MISO line. As the SPI1_NSS line was left floating in the design, it the slave is Selected (SPI1_NSS -> LOW), setting SPI1_MISO (PA6) in output-high-level.
This issue could have been avoided if:
1) the ROM bootloader enables the internal Pull-ups for the SPIx_NSS so the SPIx_MISo is left in high-impedance if the user don't force the SPIx_NSS to GND.
2) This issue is documented in the corresponding errata and/or hardware design guideline documents.
I hope that this issue will reach the relevant personal in ST so actions can be taken and avoid valuable days of debugging and PCB re-spinning to other customers.
Thanks in advance!
All the best,
Daniel Mancuso.
