Power-on to main(): what takes time?
A safety output must reach a defined state almost as soon as power is applied (assume 100 µs), and someone also asks for a boot message "right away". What happens between power-on and the first line of main(), and how do you guarantee each requirement?
| Level | ●● onsite technical |
| Track | Embedded & wearables |
| Really testing | Bring-up sequence from rails to code. |
Going deeper
Extra explanation that is not in the book: worked numbers, where people go wrong, and how to say it in the room.
A realistic timeline from power-on.
- Rail ramp and settle: ~1 ms (more with sequenced rails).
- Reset supervisor delay: commonly 140–200 ms.
- Main crystal start-up: about 1–10 ms; a 32 kHz crystal can take a second or more.
- Boot ROM, clock and PLL setup: a few ms to tens of ms; DDR training on an application processor: 100 ms or more.
- Then startup code and main(); a Linux system takes seconds.
So "a boot message right away" means hundreds of milliseconds at best on an MCU.
Designing the safe state. GPIOs are high-impedance in reset. A 10 kΩ pull-down on the gate of the output FET holds it off from the first microsecond. If the safe state must be "on", invert the logic in hardware so that the resistor gives "on".
Where people go wrong: promising a time in firmware that is shorter than the supervisor's reset delay.
Errata
No corrections known for this question. All errata
Ask about this question
Stuck on a step, or think something is wrong? Send it with EM-04 in the subject. Good questions get answered on this page, and corrections go into the next printing.
Related
← EM-03 Drive a solenoid valve from a GPIOEM-05 Reset pin design →