Arm Cortex NXP LPC17xx: Startup

29-Jul-2024

The flash bootloader code is executed every time the part is powered on or reset. The loader can execute the ISP command handler or user application code. A LOW level after reset at pin P2.10 is considered an external hardware request to start the ISP command handler.

Assuming that power supply pins are on their nominal levels when the rising edge on RESET pin is generated, it may take up to 3 ms before P2.10 is sampled and the decision on whether to continue with user code or ISP handler is made.

  • If P2.10 is sampled low and the watchdog overflow flag is set, the external hardware request to start the ISP command handler is ignored.
  • If there is no request for the ISP command handler execution (P2.10 is sampled HIGH after reset), a search is made for a valid user program.
  • If a valid user program is found then the execution control is transferred to it. 
  • If a valid user program is not found, the auto-baud routine is invoked.

Pin P2.10 is used as a hardware request signal for ISP and therefore requires special attention. Since P2.10 is in high impedance mode after reset, it is important that you provide external hardware (a pull-up resistor or other device) to put the pin in a defined state. Otherwise, an unintended entry into ISP mode may occur.

When ISP mode is entered after a power-on reset, IRC and PLL are used to generate the CCLK of 14.748 MHz.


Criterion for valid user code

The reserved Cortex-M exception vector location 7 (offset 0x 001C in the vector table) should contain the 2’s complement of the check-sum of table entries 0 through 6. 

This causes the checksum of the first 8 table entries to be 0. The bootloader code checksums the first 8 locations in sector 0 of the flash. If the result is 0, the execution control is transferred to the user code.

If the signature is not valid, the auto-baud routine synchronizes with the host via serial port 0.


    Was this answer helpful?