Entering ISP mode from UserCode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Entering ISP mode from UserCode

1,955 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fred033 on Thu Sep 18 03:25:22 MST 2014
Hello,

I'd like to enter in ISP mode with USB0 boot (to start in DFU mode).

I attempt to adapt the AN10356 to the LPC4337 without any success.

As described in the AN10356, I have done following :

- Configure Pin 2_7 as output and set to "0"

----Select USB0 boot-----
- Configure Pin 1_1 as output and set to "1"
- Configure Pin 1_2 as output and set to "0"
- Configure Pin 2_8 as output and set to "1"
- Configure Pin 2_9 as output and set to "0"

- disable all irq
- starting PLL0USB
- reset  all timers (Reset_CTRL1 register set to 0xFFFFFFFF )
- Invoke bootloader

After invoking bootloader, the watchdog provoke a reset and I never enter into ISP.

Is it possible to enter into ISP mode with USB0 boot with LPC4337 ? and What is wrong in my procedure ?

Thank you for help.
Labels (1)
0 Kudos
Reply
7 Replies

1,750 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bavarian on Fri Sep 26 00:51:58 MST 2014
Please look also here:

http://www.lpcware.com/content/forum/lpc1857-jump-usbdfu-bootloader-application

Regards,
NXP Support Team
0 Kudos
Reply

1,750 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fred033 on Thu Sep 25 06:32:12 MST 2014
Hello Nerd,

I have attached my LPCXpresso worspace with all solution I've tested.
I have no access of boot pin of the MCU, that why re invoke ISP with fixing boot pin level by software was the better solution for us.

Programming OTP memory could be a solution but how can we do that ?

Just writing following program OTP ???

#define OTP_MEMORY_BANK_3(*((volatile uint32_t *) 0x40045030))

OTP_MEMORY_BANK_3 = 0x0C000000 ;



Thank you for your help.
0 Kudos
Reply

1,750 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nerd herd on Tue Sep 23 09:17:28 MST 2014
Hi Fred033,

Do you mind sharing your exact source code with the Reinvoke ISP command so I can test myself? There is a chance that the pins need to be externally set in order to boot from USB0 in ISP mode through the boot jumpers. You do not need external pull ups or pull down resistors on the boot jumpers, but you do need to externally set them high or low. Do you not have any physical access to the pins on the MCU?

The other alternative is to program your OTP memory so that once you enter ISP mode, it should boot through USB0. Keep in mind that the OTP memory is one time programmable, so once you burn the bits, it will always boot through USB0 when in ISP mode.
0 Kudos
Reply

1,750 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fred033 on Tue Sep 23 05:07:25 MST 2014
Hello jdesbonnet,

I've changing MEMMAP address to 0x10400001 and I don't have HardFault but, I'm not entering into ISP (USB0 boot) mode, the software seems to run but debug is lost.

Thank you.
0 Kudos
Reply

1,750 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jdesbonnet on Tue Sep 23 04:32:58 MST 2014
With the Thumb instruction set, my understanding is the LSBit of the address must be set (ie +1 to those even numbered addresses). Failure to do so results in a HardFault as you describe.
0 Kudos
Reply

1,750 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fred033 on Tue Sep 23 01:40:17 MST 2014
Hi nerd,

[s]I've seen this API but I've not tested because in datasheet it is specified that when ISP mode is called through IAP command, the boot mode is UART0 and I need USB0 boot (DFU mode).[/s]

Externally invoking ISP mode is not possible, our products don't have this possibility.

After some tests :
In debug mode, when invoking bootloader CPU goes into HardFault, I think the problem is here, perhaps the address of bootloader entry point?
When I invoke bootloader I've specified address 0x10400000, is it the good one ??

My code for invoking bootloader is :

#define MEMMAP(*((volatile uint32_t *) 0x10400000))

void (*bootloader_entry)(void);

bootloader_entry = (void (*)(void))(MEMMAP);
bootloader_entry() ;


I've trying with IAP as follow :
#define IAP_LOCATION *(volatile unsigned int *)(0x10400100) ;
typedef void (*IAP)(unsigned int[5], unsigned int[4]);

IAP iap_entry=(IAP)IAP_LOCATION ;
uint32_t command[5], result[4];

----Select USB0 boot-----
- Configure Pin 1_1 as output and set to "1"
- Configure Pin 1_2 as output and set to "0"
- Configure Pin 2_8 as output and set to "1"
- Configure Pin 2_9 as output and set to "0"

command[0] = IAP_REINVOKE_ISP_CMD;
iap_entry(command, result);

With Reinvoke ISP, we start with UART0 boot when setting pin level by software (as mentioned above) but if pull-up and pull-down resistors are set to force Pin 1_1, 1_2, 2_8 and 2_9 after reinvoke ISP command I start in USB0 mode.
In our product we cannot have possibility to put this resistors.

What ccan we do to correct this problem?


Thank you.
0 Kudos
Reply

1,750 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nerd herd on Thu Sep 18 09:53:35 MST 2014
Hi Fred033,

You seem to be configuring your pins correctly, so it seems to be a matter of actually invoking ISP mode within software. If you use our LPCOpen software platform, you can open up a simple software example like Blinky, and use our user friendly API that will invoke ISP mode, such as: Chip_IAP_ReinvokeISP();

Here is a link to our latest LPCOpen release. If your board is not supported, you can always use the code here as a reference or adapt the code to fit your hardware:
http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc43xx-packages

The file you may be interested in is iap_18xx_43xx.c which contains various IAP/ISP API calls.

You don't make any mention of this, but would you be interested in externally invoking ISP mode? You just need to externally pull the ISP pin (P2_7) low during a reset and it should enter ISP mode.

Hope this helps.
0 Kudos
Reply