LPC51U68 Reinvoke ISP Fails

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

LPC51U68 Reinvoke ISP Fails

Jump to solution
4,272 Views
frank5
Contributor II

I am trying invoke USB ISP mode, to allow reprogramming from USB. My IAP call always returns the "Reinvoke configuration error" (kStatus_IAP_ReinvokeISPConfig). I am using the "lpcxpresso51u68_flashiap" sample code from the SDK, running on the demo board. I have converted the sample to use the newer fsl_iap.c driver instead of the deprecated deprecated fsl_flashiap.c driver. The Flash write, erase, and read work, but the "IAP_ReinvokeISP(2, &status)" always return with the configuration error. The code I added was:

PRINTF("\r\nIAP_ReinvokeISP\r\n");
IAP_ReinvokeISP(2, &status);
if (status != kStatus_IAP_Success) {
PRINTF("\r\nReinvoke ISP failed. Status = %lu:%lu\r\n", status / 100, status %100);
  if (status == kStatus_IAP_ReinvokeISPConfig) {
    PRINTF("Failure Code = Reinvoke configuration error\r\n");
  }
}

Running this project gives me the following messages:
==========================================
IAP example
Writing flash sector 1
Erasing flash sector 1
Erasing page 1 in flash sector 1
IAP_Unique ID workaround:
ID[0] = 0x1701704a
ID[1] = 0xaaf2cc48
ID[2] = 0x597a1b00
ID[3] = 0xf5001b80
IAP_ReinvokeISP
Reinvoke ISP failed. Status = 102:28
Failure Code = Reinvoke configuration error
End of IAP Flash Example


Can anyone point me in the right direction on what to try next?
I have attached the project files.

Labels (3)
0 Kudos
Reply
1 Solution
4,179 Views
frank5
Contributor II

Thank you,

This is the simple fix I was looking for.
The fsl_iap.c file contained in this part's SDK (SDK_2.8.2_LPCXpresso51U68) has this erroneous IAP call. I modified this file as shown above, and this allows the ROM bootloader to properly execute the Reinvoke ISP.

For others with this issue, simply replace your fsl_iap.c file with the attached version.

 

View solution in original post

0 Kudos
Reply
7 Replies
4,251 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello @frank5 ,

Are you using a custom board or is a development board?

Also, this could be related to the following post, I will suggest to take a look.

Best Regards,
Alexis Andalon

0 Kudos
Reply
4,246 Views
frank5
Contributor II

I have a custom board that I am implementing the code on. After running into roadblock on this issue on my board, I simplified the problem by switching to NXP SDK example code running on LPCExpresso51u68 board (OM40005), with exact same errors reported. Have tried snippets from suggested post and others, but no luck. I can't find any reference to what "Configuration Error" means. Is this a problem with the configuration block passed in the parameter, USB configuration, or I/O configuration, or clock configuration. Is there any way to troubleshoot what the error is referring to, other than shotgun approach of changing everything one by one? Is there any sample or user code on an LPC51u68 where this actually runs, so I can compare differences and isolate the problem?

0 Kudos
Reply
4,229 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello @frank5,

The API syntax looks fine so to test if the ISP can enter in some way, could you try using another interface, for example, UART to check if it's possible to enter ISP mode?

Best Regards,
Alexis Andalon

0 Kudos
Reply
4,210 Views
frank5
Contributor II

I get the same error code asking for UART as selected ISP mode:
Param0(mode): Selected ISP mode. 1=USART, 2=USB, 5=I2C, 6=SPI

The Reinvoke ISP command always returns with the same error code:
ERR_ISP_REINVOKE_ISP_CONFIG

It is acting as if I need to configure clocks, registers or some other
hardware before executing the call, but the documentation gives me no
hints as to what to look for. What does the ROM driver look for to 
determine when to generate this error?

 

 

0 Kudos
Reply
4,192 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hello Frank,

Looks like the API to call the reinvoke ISP has some errors, try to change it for the next one: 

void IAP_ReinvokeISP(uint8_t ispType, uint32_t *status)
{
    uint32_t command[5] = {0x00U};
    uint32_t result[5]  = {0x00U};
    uint8_t ispParameterArray[8];

    command[0] = (uint32_t)kIapCmd_IAP_ReinvokeISP;
    command[1] = (uint32_t)ispType;
    iap_entry(command, result);
    *status = (uint32_t)translate_iap_status(result[0]);
}

Best Regards,

Alexis Andalon

 

0 Kudos
Reply
4,180 Views
frank5
Contributor II

Thank you,

This is the simple fix I was looking for.
The fsl_iap.c file contained in this part's SDK (SDK_2.8.2_LPCXpresso51U68) has this erroneous IAP call. I modified this file as shown above, and this allows the ROM bootloader to properly execute the Reinvoke ISP.

For others with this issue, simply replace your fsl_iap.c file with the attached version.

 

0 Kudos
Reply
4,129 Views
frank5
Contributor II

A complete working project requires the fix to the fsl_iap.c file in the sdk, and also a modification to the iap_entry macro to allow this function to operate without disabling interrupts. Disabling interrupts will cause the ROM bootloader to hang without servicing the USB interrupts required to enumerate as a flash drive. 

Attached is the complete working demo which runs on the OM40005 LPCXpresso51U68 demo board. Attach usb cables to both J5 and J6. When the program runs, a flash drive "CRP DISABLD" will appear, allowing update of the CPU flash.

0 Kudos
Reply