Author Topic: Starting application code from ISP  (Read 7659 times)

nxpdave

  • Jr. Member
  • **
  • Posts: 1
    • View Profile
Starting application code from ISP
« on: March 05, 2012, 09:43:04 am »
I have a project with an LPC1759 where I'd really like to start the application from the ISP after loading is finished, but I can't make it work.  Yes, I know a hardware reset will do it but I hate to add the cost of additional parts on the board to use one of the RS232 handshakes for reset.

The reset vector is at memory address 4.  I was thinking that I could read the contents of memory address 4 and use it with the ISP Go command.

The address at location 4 has the LSB set because it's a Thumb-2 instruction (that's my understanding anyway).  If I use the ISP Go command with the address from location 4, I get an error message because the address is not on a word boundary.  If I clear the LSB of the address and use it with the Go command, I get positive acknowledgement but the application does not start.

I know that the clock is going to be set for 14.XX MHz from the internal RC clock/PLL when ISP exits via the Go command, but I can't see why that would keep my application from starting up.  After that my startup code would reset the clock to the desired value before using any clock-critical code executes.

Is there some other technique to invoke the application from ISP without a hardware reset?  Can it be done via the Go command and I'm just doing something wrong and can't see the forest for the trees?

Thanks,
Dave

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Starting application code from ISP
« Reply #1 on: March 07, 2012, 08:43:54 am »
You should be able to use the Go command with address 0x00000000. If that doesn't work then I would suspect a problem with your firmmare - perhaps it makes assumptions about the state of the registers? I.e. you use OR and AND to set/clear bits instead of assigning complete values to the registers.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

dragon813

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: Starting application code from ISP
« Reply #2 on: March 07, 2012, 05:55:22 pm »
I have a similar issue when I use LPC1102.
I use Flash Magic command line interface to run " EXECUTE(0x0,THUMB)". I expected the ISP mode will quit and the application code will start to run form 0x0 address. But what I saw is the ISP mode did quit but my code never run correctly unless I power cycle it.
Any idea?

Thanks.
Dragon

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2190
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Starting application code from ISP
« Reply #3 on: March 09, 2012, 07:51:32 am »
Here are the details of the test I just performed to verify this feature works correctly:

Keil MCB1700 board v1.2 with LPC1768.
Flash Magic 6.20
The RST jumper is open, the INT0 jumper is closed, flash is erased.
Using the Keil Blinky example from C:\Keil\ARM\Boards\Keil\MCB1700\Blinky

Power on the board and all LEDs are turned on.
Press both RST and INT0 buttons then release RST button followed by INT0 button to start the UART bootloader.
Select LPC1768, COM1, 19200 baud, no interface, 12MHz oscillator, erase all flash, program Blinky.hex.
Clicked on Start and programming completed without error. All LEDs on the board still on.
Choose ISP->Go
Enter address 0x00000000 and close delay of 1000ms.
Click on "Go".

At this point the firmware is executing and the "walking LEDs" pattern is being displayed as expected.

Next I tried the same process but with the command line interface.

Reset the device using RST and INT0 to run the UART bootloader.
Executed the commands using: fm @fmtest.txt

At this point the "walking LEDs" pattern was again being displayed as expected. Here are the commands used (fmtext.txt):

COM(1, 19200)
DEVICE(LPC1768, 12.000000)
ERASE(DEVICE, PROTECTISP)
HEXFILE(Blinky.hex, NOCHECKSUMS, NO FILL, PROTECTISP)
EXECUTE(0x00000000, THUMB)

So the execute/Go feature appears to be working fine. You can find the Keil MCB1700 schematic diagram here:

http://www.keil.com/mcb1700/mcb1700-schematics.pdf

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com