PSoC Boot Time

Question: What is the booting time for PSoC, i.e., between POR (or XRES) and the first line of main() ?



The booting time of the PSoC depends on the type of reset and the amount of resources to be configured. 

Total Time = (Time to release internal CPU Reset) + (Boot Calibration) + (Time to execute boot.asm) + (Optional 1 Second ECO stabilization time)

Refer Section 30 of Technical Reference Manual.  This section has timing diagrams for various resets.  For a IPOR reset, the internal CPU reset is released after 512 clocks of the internal 32K oscillator and for a PPOR reset, the internal CPU reset is released after 1 clock cycle of the internal 32K oscillator. This oscillator is untrimmed at this point of time. And so it has a very wide tolerance and can range from 5KHz (untrimmed min value) to 64KHz, this time could be 8mS to 100ms, typically 16ms. 

Worst Case : (512+1) * (1/5KHz) ~ 100ms

Best Case : (512+1) * (1/64KHz) ~ 8ms

Typical Case : (512+1) * (1/32KHz) ~ 16ms

This is how the Tpowerup parameter is being calculated and mentioned in the Datasheet.

Note: In the above calculation, we have used the least possible freqy of Untrimmed 32KHz oscillator instead of the Trimmed one.

If XRES is used to reset the processor, then the CPU reset is released after 8 cycles of the 32K oscillator, which would be 125us to 1.6ms.

Once the internal reset to the CPU is released, a boot calibration is performed, which takes about 2.2ms. SROM code will be executed during this time.  After this, the CPU starts executing the instructions from the reset vector.

The time taken to execute boot.asm depends on the amount of resources used in the project and the time taken to initialize these resources.  On a test project with an UART, an 8-bit PWM and an 8-bit counter, it took 4.73mS from _Start to _main.  Also, if you have enabled the External Crystal Oscillator and have set the WAIT_FOR_32K constant in the boot.asm to 1, the boot.asm will wait 1 second for the ECO to stabilize.