Enter USB ISP mode from application code for LPC1343?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Enter USB ISP mode from application code for LPC1343?

2,379件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wsyuen on Tue Nov 16 19:10:23 MST 2010
For a product, it is not possible to add a jumper externally to set the PIO0_1 to low.
Is it possible to enter the USB ISP mode (the one act as MSC) from application code? (e.g. after the application code detects a certain key pattern).
Thank you.
0 件の賞賛
返信
11 返答(返信)

2,269件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cyberstudio on Wed Jan 05 18:09:47 MST 2011
I was using lpc21isp which begins memory usage at 0x1000 0300. I hit a ceiling at about 0x1000 1100, after which the bootloader hangs. (To write a 4K sector, it would require 0x1000 0300 - 0x1000 1300, and bootloader hangs at about 0x1000 1100.) In theory it isn't stumbling upon bootloader's own memory range you specified, unless bootloader somehow decides to move the memory region it uses up by 4K. (This is a wild speculation but I will try moving the memory range down to 0x1000 0000 to see if it hangs almost immediately.)
0 件の賞賛
返信

2,269件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by domen on Mon Jan 03 07:15:22 MST 2011
ISP uses ram 0x1000017c to 0x1000025b and 256 top bytes for stack. Maybe you're running over some of this?
0 件の賞賛
返信

2,269件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cyberstudio on Mon Jan 03 04:25:21 MST 2011
Tried the autoisp sample and it kind-of-worked for me. I got it to recognize the '?' character but afterwards it begins to do strange things, such as becoming unresponsive shortly afterwards. This was with a LPC1114 but I do not know if it makes any difference.

My own app was also able to enter bootloader successfully using the ReinvokeISP() call, but the biggest chunk I was able to write to flash, once in bootloader, was 1K. After some tracing I found that I could not use the 'W' command to write to RAM above address 0x10001100 (approx), or it would kill the bootloader and hang. I suspected there may have been a conflict between the stack and the RAM memory used to hold the data being copied to flash, but I couldn't figure out how the stack could get so low for my small app.

What I do not understand at all was why we are setting the main stack pointer to 0x1fff0000? That was where the boot ROM is. Why not point to the top of RAM instead? (However, setting MSP to the beginning to boot ROM does work, but setting it to top of RAM doesn't.)

Any help would be greatly appreciated.
0 件の賞賛
返信

2,269件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Nov 22 17:06:44 MST 2010
Again: this sample is working.:)
0 件の賞賛
返信

2,269件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by strohmj on Mon Nov 22 17:01:25 MST 2010

Quote: wsyuen
Finally, I got it works.
I think there was some mistakes in the initialization code for the IAP function.
Thank you all!!



What were the mistakes? I'm having issues getting the example to work as well. Thanks.
0 件の賞賛
返信

2,269件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wsyuen on Thu Nov 18 00:09:23 MST 2010
Finally, I got it works.
I think there was some mistakes in the initialization code for the IAP function.
Thank you all!!
0 件の賞賛
返信

2,269件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by domen on Wed Nov 17 07:45:48 MST 2010
So, when you Reinvoke ISP, it will sample PIO0_3? Good to know.
0 件の賞賛
返信

2,269件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Wed Nov 17 02:15:19 MST 2010

Quote: wsyuen

However, I tried the example but do not get the expected result.

My board is connected the USB cable to PC



You aren't just using the USB connector on the LPC-Link end of the LPCXpresso board are you? This is a debug only connector. If you want to use USB peripheral on the LPC1343, you need to add a USB connector.

See section 7.3 of the LPCXpresso Getting Started document for more details (inside the install directory of the LPCXPresso IDE, or from http://ics.nxp.com/lpcxpresso/#Support).

There are also a number of previous threads about USB connection, for example http://knowledgebase.nxp.com/showthread.php?t=742.

Regards,
CodeRedSupport.
0 件の賞賛
返信

2,269件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Nov 17 01:45:52 MST 2010
:confused:
You tried the sample and what happened?

I tried this sample, it's working :)
0 件の賞賛
返信

2,268件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wsyuen on Wed Nov 17 01:31:47 MST 2010
Thank you!!

However, I tried the example but do not get the expected result.

My board is connected the USB cable to PC. In my code, I tried to call the ReinvokeISP() function after reset and some initializations. I expected the USB ISP Mass Storage will be pop up, but it doesn't. Would you give some advice? Here is part of my code:

int main (void)
{
    SystemInit();
    GPIOInit();

    ReinvokeISP();
    __WFI();
    .
    .
    .
}

void ReinvokeISP(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;

command_IAP[0] = 57;

  __set_MSP(*((uint32_t *)0x1FFF0000)); /* inline asm function */

iap_entry(command_IAP, result_IAP);

}
0 件の賞賛
返信

2,269件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Nov 16 19:44:31 MST 2010
Yes: 'Reinvoke ISP'
See Chapter 19, IAP command 57 :)

Usage is shown in 'AUTOISP' sample.

http://ics.nxp.com/support/lpcxpresso/#Examples
0 件の賞賛
返信