2019-11-19 08:15 AM
I have multiple boards with a STM32L051 MCU and 2 board revision, A and B.
A: no LSE oscillator, LED connected via 550 Ohm resistor, around 20uF capacitance on VCC, radio module soldered
B: 6pF 32kHz +-20 ppm oscillator soldered, 9pF load capacitors, a +-20 ppm accuracy oscilloscope shows me an error of the LSE of ~12 ppm (measured via MCO pin).
LED connected via 2k resistor, around 10uF capacitance on VCC, no radio module soldered
Here's the problem:
If I use AC6 to program board A, do an upload + reset the board via AC6, everything is working fine. The board starts up, LED blinks.
If I use the same procedure for board B, even when only LSI is configured in software, the code gets uploaded, but the board is stuck somewhere - no LED blinking.
The same holds true for when I disconnect/connect a battery. If I do it multiple times, sometimes board B is working. Every 2nd time or so.
The strange thing is: When debugging on board A or B everything is working normally. I can also use the LSE - it starts up within ~1 second.
I have designed the board according to the oscillator design guideline: very short traces, guard ring.
I cannot say if this startup issue has anything to do with the LSE. Maybe it's a capacitance issue, or something else. But why is debugging working then flawlessly?
2019-11-20 06:59 AM
I have built a second device (board B) now.
I have used 10pF +-5% load capacitors this time. The frequency error of the LSE measured with an oscilloscope has fallen from 12ppm to 3 ppm.
But the main problem persists.
I cannot make the board run by connecting 3.3V to it (tried with LSE enabled).
I can make it run by connecting 1.8V though (again: LSE enabled)! And it seems to work every time.
I can also make it run by connecting an STLink with 3.3V and debugging the code. This works.
But it does not work by connecting 2.4V from a battery or 3.3V from the STLINK (without debugging).
2019-11-20 07:29 AM
Ok, I've found the error.
Wrong board layout. I have connected load capacitor GND to Boot0 but have not connected Boot0 to GND...
That is: I have mistaken Boot0 pin as a GND pin of the MCU...
A wonder that it's working at all...