Hi, all.
My custom board has a LPC2368 installed and runs FreeRTOS. What I am trying to do is to invoke bootloader in ISP mode from my application - to allow in-field firmware upgrade, when FlashMagic tool will be used.
I referred the NXP appnote AN10356 to get a clue of how to do it. What I changed in the example given by the appnote, is the use of GPIO pin P0.14, since the silicon user's manual declares, that GPIO pin P2.10 is checked by the bootloader.
Also, I tried to use the IAP command 57 - in order to, as declared by the user's manual, simplify my job. In this case, I care to reset the PLL and disable the watchdog.
Eventually, none of these options worked for me. What I see is that when I command my software to invoke the bootloader in ISP mode, the board resets and goes to bootloader, but the bootloader jumps to application code instead of staying in the ISP mode and wait for firmware upgrade.
Please find enclosed below the code:
typedef void ( *TFpIap_t ) ( unsigned long cmd [] , unsigned long stat [] );
void invoke_isp1( void ) { SIapCallData_t call_data; static TFpIap_t s_iap_func = ( TFpIap_t )IAP_LOCATION;
// disconnect PLL PLLCON = 0x0; PLLFEED = 0xAA; PLLFEED= 0x55;
// set peripheral bus to 1/4th of the system clock VPBDIV = 0x0;
// disable the watchdog WDMOD = ~( 0x3 );
// invoke the IAP call call_data.cmd = LPC_IAP_CMD_REINVOKE_ISP; // 57 s_iap_func( &call_data.cmd, &call_data.stat ); }
void invoke_isp2( void ) { void ( *bootloader_entry )( void ) = ( void* )0;
// reset PINSEL (set all pins to GPIO) PINSEL0 = 0x00000000; PINSEL1 = 0x00000000; PINSEL4 = 0x00000000;
FIODIR2 = BIT10; // controlled P2.10 is an output FIOCLR2 = BIT10; // drive P2.10 low
// power up all peripherals PCONP = 0x03BE;
// disconnect PLLCON = 0x00; PLLFEED = 0xAA; PLLFEED = 0x55;
// set peripheral bus to 1/4th of the system clock VPBDIV = 0x00;
// map bootloader vectors MEMMAP = 0;
// set up a watchdog timer to exit ISP mode WDTC = 5000 * 1000; // sufficient time to upgrade the firmware WDMOD = 0x03; WDFEED = 0xAA; WDFEED = 0x55;
// jump to the bootloader address bootloader_entry(); }
Any idea why doesn't it work ?
Thanks in advance. mb