Hi,
I just spent a few days fighting to get a new board to reset reliably.
One of the problems encountered was due to the board's having a 1kOhm resistor in series with its 3.3V power input until bypassed by a FET under software control. This was done to limit inrush, as up to sixty of these boards may be mounted on a single I2C bus.
Unfortunately, the STM32L1xx does not startup in a low-power run state. Directly after reset, it is running on the MSI clock at approximately 2Mhz drawing about 2ma. Even after putting code in __early_init() to get the CPU into a low-power run mode, where it should have been drawing <100microamps, I observed high current consumption for 50ms before the board *eventually* finished resetting itself.
My fix was to move the __early_init() call before the stack is filled with a canary pattern.
I could have simply turned the stack fill config option off, but I really do like it.
Stack fill is a great feature, but it conflicts with this scenario. Before stack fill could complete, the CPU voltage would sag to the point to resetting again (many times).
Is there some scenario that requires the stack to be filled before __early_init() is invoked?
I suppose __early_init() would not get the benefit of the canary pattern to detect a stack overflow...
However, detecting a stack overflow in __early_init() should be obvious just by looking at the Stack Pointer.
There is only one context that early in the system initialization. Right?
The __earlyInit() hook was not early enough Topic is solved
-
- Posts: 65
- Joined: Thu Oct 03, 2013 1:06 am
- Location: Santa Cruz, California
- Has thanked: 1 time
- Been thanked: 1 time
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: The __earlyInit() hook was not early enough
Hi,
I will consider this change, moving this topic in "change request".
Giovanni
I will consider this change, moving this topic in "change request".
Giovanni
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: The __earlyInit() hook was not early enough
Hi,
Which version are you using? __early_init() is called before stack already in 17.6.x.
Giovanni
Which version are you using? __early_init() is called before stack already in 17.6.x.
Giovanni
Return to “Small Change Requests”
Who is online
Users browsing this forum: No registered users and 2 guests