LPC11U24 and IAP Reinvoke ISP

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

LPC11U24 and IAP Reinvoke ISP

257 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tarmo on Fri May 18 04:02:52 MST 2012
Hi

How do i start ISP as [B]MSC USB device[/B] on LPC11U24 using [B]IAP Reinvoke ISP[/B] command (57).  The following code works well on LPC1343 but not on LPC11U24.
I can execute ISP as USB MSC device during reset or power on (PIO0_1 low & PIO0_3 high).
All other IAP commands are working well. So i think the problem is with init_msdstate() function.


#define IAP_LOCATION 0x1fff1ff1
typedef void (*IAP)(unsigned int[], unsigned int[]);
IAP iap_entry = (IAP) IAP_LOCATION;
#define CMD_SUCCESS 0

unsigned int Command[5];
unsigned int Result[4];

#define init_msdstate() *((uint32_t *)(0x10000054)) = 0x0

void EnterISP(void) {
/* make sure USB clock is turned on before calling ISP */
LPC_SYSCON->SYSAHBCLKCTRL |= 0x04000;
/* make sure 32-bit Timer 1 is turned on before calling ISP */
LPC_SYSCON->SYSAHBCLKCTRL |= 0x00400;
/* make sure GPIO clock is turned on before calling ISP */
LPC_SYSCON->SYSAHBCLKCTRL |= 0x00040;
/* make sure IO configuration clock is turned on before calling ISP */
LPC_SYSCON->SYSAHBCLKCTRL |= 0x10000;
/* make sure AHB clock divider is 1:1 */
LPC_SYSCON->SYSAHBCLKDIV = 1;

/* Send Reinvoke ISP command to ISP entry point*/
Command[0] = 57;

init_msdstate(); /* Initialize Storage state machine */
/* Set stack pointer to ROM value (reset default) This must be the last
piece of code executed before calling ISP, because most C expressions
and function returns will fail after the stack pointer is changed. */
__set_MSP(*((uint32_t *) 0x1FFF0000)); /* inline asm function */

/* Enter ISP. We call "iap_entry" to enter ISP because the ISP entry is done
through the same command interface as IAP. */
iap_entry(Command, Result);
// Not supposed to come back!
}
0 Kudos
1 Reply

186 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri May 18 05:05:02 MST 2012
[Quote]
All other IAP commands are working well. So i think the problem is with init_msdstate() function.
[/Quote]That's LPC13 code :rolleyes:

Quote:

6. Initialize the mass storage state machine:
(uint32_t *) BulkStage = 0x10000054;
*BulkStage = 0x0;

I'm not familiar with LPC11Uxx, but I think (wild guess :eek:) you should try to reset your USB with something like

UM Table 191:

Quote:

Reset void(*void USBD_HW_API::Reset)(USBD_HANDLE_T hUsb)
Function to Reset USB device stack and hardware controller

0 Kudos