Hello,
I'm working on LPC1768 ISP application through LPC1768 UART commands.
I designed an external PCB with second MCU and SPI flash that receive form PC hex file to download in LPC1768 (the hex file is saved in SPI flash) and then wrote data in LCP1768 via ISP commands.
PC to second MCU protocol got CRC on command, so I'm quite sure hex file is transfered correctly inside SPI flash.
I developed LPC ISP protocol and commands.
What happens is that I got "OK" for all LPC1768 ISP commands, but program is not running.
My ISP commands sequence to download in LPC1768 flash is (ISP UART protocol is working because LPC1768 reply is always OK):
// binSize is the hex file size, in byte. Then I got needed sector count
flashNeededSectorCount = _get_flash_sector_index(binSize);
// Set LPC1768 in ISP mode
lpc1768IspManagerEnterIspMode();
// LPC1768 baudrate syncro
lpc1768IspManagerBaudRateSyncro(uartBusPtr);
// Disasble echo
lpc1768IspManagerDisableEcho(uartBusPtr);
// UnLock
lpc1768IspManagerUnlock(uartBusPtr);
// Prepare needed sector
lpc1768IspManagerPrepareSector(uartBusPtr, 0, flashNeededSectorCount - 1);
// Erase needed sector
lpc1768IspManagerEraseSector(uartBusPtr, 0, flashNeededSectorCount - 1);
// Load program (flashAddress is LPC1768 write flash address)
for(flashAddress = 0; flashAddress < binSize; ) {
// Write to LPC1768 RAM data
lpc1768IspManagerWriteToRAM(uartBusPtr, 0x10000200 + (uint32_t)index, &binData[index], writeLen);
// Prepare selected flash sector
flashSectorCount = _get_flash_sector_index(flashAddress);
lpc1768IspManagerPrepareSector(uartBusPtr, 0, flashSectorCount);
// Copy from RAM to FLASH
lpc1768IspManagerCopyRAMToFlash(uartBusPtr, flashAddress, 0x10000200, sizeof(binData));
flashAddress += binDataLen;
}
// Go
lpc1768IspManagerGo(uartBusPtr, 0);
// Remove ISP mode
lpc1768Reset();
lpc1768RemoveForISP();
tommRoCOsDelayMsec(1500);
lpc1768RemoveReset();