LPC15XX ReInvoke ISP

Content originally posted in LPCWare by berrymccormick on Fri Jul 18 11:35:47 MST 2014I'm working on an LPC1549 xpresso v2 board, and I'm trying to get the chip to go into ISP mode by using the ReInvoke ISP command. I couldn't find any code for the LPC15XX, but I found some for the LPC11UXX, LPC13XX, etc. I'm using the function below:

void ReinvokeISP(void){ // make sure USB clock is turned on before calling ISP Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_USB); // make sure GPIO clocks are turned on before calling ISP Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO0);Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO1);Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO2); // make sure IO configuration clock is turned on before calling ISP Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);

// make sure AHB clock divider is 1:1 Chip_Clock_SetSysClockDiv(1);

// Send Reinvoke ISP command to ISP entry point command[0] = 57;

__disable_irq();

// Enter ISP. We call "iap_entry" to enter ISP because the ISP entry is done // through the same command interface as IAP. iap_entry(command, result);

// Not supposed to come back! while(1);}

The documentation for the chip simply says:

This command is used to invoke the boot loader in ISP mode. It maps bootvectors and configures the peripherals for ISP. Which peripheral (UART, C_CAN,UART, or USB) is selected for ISP mode depends on the parameter written withthis command.This command may be used when a valid user program is present in the internalflash memory and the ISP entry pins are not accessible to force the ISP mode.Before calling this command, enable the clocks to the GPIO0/1/2 blocks in theSYSAHBCLKCTRL0 register.

I know that the IAP portion of the code is working because I can read the part number with the lines below: