Main Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - whitewing

I posted this to the LPC2000 list a while ago - thought it may be useful to people here as well :
There are some omissions from the NXP UM (LPC2136/01) regarding the 'Reinvoke ISP' command in IAP (this is used to get into the bootloader where the P0.14 pin is not easily accessible)

Before making the call to start the bootloader, you need to set SCS to 0 to disable fast IO, and set U0FDR to 0 to disable the fractional baudrate divider.  I suspect the same issues apply to all parts with FIO and fractional baudrate divider.

This code (IAR) works :
__arm void startboot(void)
   PLLFEED = 0xAA;
   PLLFEED = 0x55;
   SCS=0; // disable fast IO
   U0FDR=0; // no FDR - causes wrong baudrate if <>0
   asm("mov r0,#0x40000000");
   asm("mov r1,r0"); // even though no return expected, R1 MUST be initialised!
   asm("mov r2,#0x39");
   asm("str r2,[r0]");
   asm("mov r2,#0x7ffffff1");
   asm("bx r2");
There are situations where it would be useful to be able to force a device reset after successful programming (via software, not the reset pin).
The sort of situation I'm thinking about is where the bootloader is started using the 'reinvoke ISP' command from within the application. This allows the firmware upgrade process to be started down a serial link (via a serial command to the app software to invoke the bootloader), but there is then no way to remotely get out again.
I've done a couple of jobs recently where we temporarily installed a radio modem for remote configuring and diagnostics, and the ability to also reprogram firmware over the same link without writing our own IAP code would be nice.

This could be achieved fairly easily by downloading & executing a short piece of code that switched on the watchdog and allowed it to time out. (This would be preferable to a simple branch to 0 as it ensures all hardware is in its normal reset state)