I would like to invoke the ISP USB MSD from my LPC11U24 based application. Is there a white paper on how to do this using the LCPxpress IDE and associated drivers for the chip?

cancel
Showing results for 
Search instead for 
Did you mean: 

I would like to invoke the ISP USB MSD from my LPC11U24 based application. Is there a white paper on how to do this using the LCPxpress IDE and associated drivers for the chip?

822 Views
timothymasters
Contributor II

We have a FoUSB cable that has a toggle switch which sets the GPIO to invoke ISP USB flash mode upon power up. This works fine. Now that I have my application code running, I would like to create a means to invoke this over my user interface so the toggle switches are not necessary.

Is there documentation on how to jump to the ISP USB mode described above from the application code?  I am using the LCPxpress IDE and C.

Any help would be appreciated.

Thanks

Tim

10 Replies

258 Views
ckphua
NXP Employee
NXP Employee

Hi Tim,

Going back to your original question...invoke the ISP USB MSD from my LPC11U24 based application; there is an application note with source code to do this:-

AN11305: USB In-System Programming with the LPC11U3X/LPC11U2X | www.LPCware.com 

There you will look for  directory ->source -> firmwaresrc ->autoisp_11u ->src ->autoisp_main.c

In the autoisp_main.c, you will find the ReinvokeISP() ,this should give you necessary info

CK

0 Kudos

258 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi Timothy Masters,

Sorry for reply late as the Chinese New Year Holiday.

1. To generate the hex file.
    Please refer to the thread: Ilektronx: How to generate .hex files from Code Red's LPCXpresso to use with FlashMagic 

2. Reinvoke ISP fails.

Please refer to the following code.

#define IAP_REINVOKE_ISP_CMD        57     /*!< Reinvoke ISP */

/* Pointer to ROM IAP entry functions */
#define IAP_ENTRY_LOCATION        0X1FFF1FF1

/**
 * @brief LPC11U6X IAP_ENTRY API function type
 */
static INLINE void iap_entry(unsigned int cmd_param[5], unsigned int status_result[4])
{
     ((IAP_ENTRY_T) IAP_ENTRY_LOCATION)(cmd_param, status_result);
}


uint32_t command[5], result[4];

command[0] = IAP_REINVOKE_ISP_CMD;     

iap_entry(command, result);

                         ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

258 Views
timothymasters
Contributor II

Hi Ping,

Thanks for the reply but the ISP still does not work. I am trying to use FlashMagic as instructed by NXP. They advise a debugging of the ISP invocation can be done by sending a '?' character after invoking the ISP. If the ISP is in the proper mode, the ISP will echo the '?' (0x3F).  The system is going somewhere from the application code now, but still fails to echo the character. 

I am using the system in Debug mode and invocation of the Reinvoke Command results in a HardFault with the debugger. So I am running this program outside the debugger with no success.

I am certain the serial port works as I use a serial command to invoke the Reinvoke ISP command. I send 0x3F characters to the ARM part to try and get an echo. But nothing is echoed.

Any suggestions?

Tim

0 Kudos

258 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi Timothy Masters,

Thanks for your reply.

I'd like to replicate your issue by using the below code at first, as the result, the code works well (Seeing Fig 1) and it's compliant with Boot process section in the UM.

/* Reinvoke ISP */
uint8_t Chip_IAP_ReinvokeISP(void)
{
     uint32_t command[5], result[5];

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

     return result[0];
}
‍‍‍‍‍‍‍‍‍‍

2017-02-04_16-39-55.jpg

                                                                   Fig 1

Hope this is clear
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

258 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi Timothy Masters,

Thank you for your interest in NXP Semiconductor products and the opportunity to serve you.

I'm afraid your purpose can't achieve, as the Reinvoke ISP command is used to invoke the bootloader in UART ISP mode.

Hope this is clear.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

258 Views
timothymasters
Contributor II

Ok.  So you can't invoke the USB ISP option?  Seems strange since the device supports the USB and UART invoked by setting PIO-0 and PIO0_3 at POR. I used this in another LCP ARM device several years ago with FoUSB.

Here are my follow up questions:

1.If I have to use serial is there a program to upload the bin file over the serial interface?  

2.What UART does it use?  

3.What is the communication configuration?

Thanks for helping me out.

Tim

0 Kudos

258 Views
timothymasters
Contributor II

Hi Ping,

I downloaded and installed Flash Magic as you recommended. I reviewed the documentation in the manual about invoking the ISP over the UART. 

I have some questions and would appreciate your assistance and verification of my understanding:

1. Reinvoke ISP Invocation from Application

   //here is my code//

   #define IAP_LOCATION 0x1FFF1FF1

   uint16_t   command, status_result;

   uint16_t   *command_parameter, *command_result;

  command = 0x57;   //command to Reinvoke_ISP

  command_parameter = &command;

  iap_entry = IAP_LOCATION;

  iap_entry(command_parameter, command_result);   //note that there is no reply from Reinvoke ISP

2. What is the baud rate for the serial UART ISP used by Flash Magic?

 

    *  Flash Magic has a scroll down menu for selecting baud rate

    *  Is there a default baud rate that must be used by Flash Magic?

    *  Or can the baud rate for the ISP-Flash Magic communication be set prior to iap_entry by setting UART0 baud rate?

3.  Flash Magic seems to only work with the Intel Hex format. Is there a utility in LCPXpress for creating an Intel Hex file from AXF?  It seems to only have the option to select a binary file.

4.  Reset to Application Code

     I assume that reentry back to the application can only occur by cycling power back into the application after ISP programming.  Is this a correct assumption?

Thanks

Timothy Masters

0 Kudos

258 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi Timothy Masters,

Thanks for your reply.

1) What is the baud rate for the serial UART ISP used by Flash Magic?

     Just choose the default baud rate is ok.

2) Flash Magic seems to only work with the Intel Hex format. Is there a utility in LCPXpress for creating an Intel Hex file from AXF?  It seems to only have the option to select a binary file.

To generate the bin from the executable file axf file, you use the tool: arm-none-eabi-objcopy which resides in the ~\LPCXpresso_8.2.2_650\lpcxpresso\tools\bin by inputting these command : arm-none-eabi-objcopy -v -o binary "xx.axf" "xx.bin".

3)  Reset to Application Code

     I assume that reentry back to the application can only occur by cycling power back into the application after ISP programming.  Is this a correct assumption?

Yes, you're right.

Hope it helps.
Have a great day,
Ping

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!

0 Kudos

258 Views
timothymasters
Contributor II

Hi Ping,

Your reply was not helpful. You did not reply to my invocation code example. I have tried the code and it does not work.

For your information, Flash Magic does not work with a binary file. It must be an intel hex file. So apparently the LCPXpress does not have a utility to generate an Intel hex file of the executable. I was able to find a translator program to do this successfully.

Now I need help in understanding why my Reinvoke() function does not work. Here is the code:

Reinvoke ISP Invocation from Application

//here is my code//

#define IAP_LOCATION 0x1FFF1FF1

uint16_t command, status_result;

uint16_t *command_parameter, *command_result;

command = 0x57; //command to Reinvoke_ISP

command_parameter = &command;

iap_entry = IAP_LOCATION;

iap_entry(command_parameter, command_result);

The above code compiles successfully but the application does not seem to transfer control to the ISP function. Instead, the application seems to run as if it is ignored. Here are some follow up questions:

1. I am running the program through the debugger. Could this be the problem?

2. I am using unsigned 16 bit variables. Should they be 32 bit?

3. If you can not help me with this problem can you escalate this to some one more familiar with this issue. I need to ship to my customer by Jan. 27.

Thanks for your help.

Tim

512-635-4963

0 Kudos

258 Views
jeremyzhou
NXP TechSupport
NXP TechSupport

Hi Timothy Masters,

Thanks for your reply.

First, you should needs a UART TTL Serial cable which is used to connect the MCU to the PC.

Then go to Flash Magic - Welcome  to learn these information about using the ISP mode to program the MCU.

Hope it helps.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos