How to reinvoke bootloader in LPC824 with iap command?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to reinvoke bootloader in LPC824 with iap command?

3,136 次查看
ranjithshanbhag
Contributor III

#kerry zhou

i am trying to invoke ISP boot-loader from iap command. Found it is generating auto-baud and responding back with required details(mentioned in user manual UM10800 of LPC 824 page no 12-13).

Problem what i am facing is it is not staying in boot mode for long time and it resetting.

Can someone help me how to sort out this problem?

Below is the code to reinvoke isp.

#define REINVOKE_ISP        57

int iap_reinvoke_isp(void)
{
    cmd_table.cmd_code = REINVOKE_ISP;

    __disable_irq();
    iap_call(&cmd_table, &result_table);
    __enable_irq();

    return (int)result_table.ret_code;
}

标签 (1)
标记 (1)
0 项奖励
回复
7 回复数

2,367 次查看
jespermadsen
Contributor III

I had similar problems on the LPCXpresso845MAX board.

It took me a while to figure out that the default pin initialization of UART 0 in board_init(() is another than the ISP initialization.

0 项奖励
回复

2,367 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Ranjith,

   Sorry for my later reply, I just get your question post case.

  Next time, you need to use @ somebody, then the detail person will get the message.

  Now, do you mean, in IAP, if you use invoke ISP bootloader command, then you will enter ISP mode, but if you don't do the operation with the according ISP, the ISP mode will be exit? Is the question right? In your side, how long it will be exit, how did you find the mode is exit(do the reset)?

  Please confirm the question, then I will do the testing on my side.


Have a great day,
Kerry

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

0 项奖励
回复

2,367 次查看
ranjithshanbhag
Contributor III

Hi Kerry,

Thanks for your reply.

within 1 second it will exit from ISP mode. It will reset the micro-controller and starts executing application code.

A LOW level after reset at the ISP entry pin is considered as an external hardware request to start the ISP command handler via USART. Firmware can be upgraded from GUI(Flash magic).

Similar behavior i am expecting when re-invoke ISP is done from code. Whether my assumption is right?

Hope this much information is sufficient to move forward.

0 项奖励
回复

2,367 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Ranjith,

   I use the lpcopen code and test it on my LPCXpresso 824 MAX board, I didn't reproduce your problem.

 Code link is:

https://www.nxp.com/support/developer-resources/software-development-tools/developer-resources-/lpco...

I use flashiap project, and the main code is like this:

int main(void)
{
     int i;
     uint8_t ret_code;
     uint32_t part_id;
     uint32_t unique_id[4];
        unsigned int j,k;
     /* Generic Initialization */
     SystemCoreClockUpdate();
     Board_Init();
     Board_LED_Set(0, false);

     /* Enable SysTick Timer */
     SysTick_Config(SystemCoreClock / TICKRATE_HZ);

     /* Initialize the array data to be written to FLASH */
     for (i = 0; i < ARRAY_ELEMENTS; i++) {
          src_iap_array_data[i] = 0x11223340 + i;
     }

     /* Read Part Identification Number*/
     part_id = Chip_IAP_ReadPID();
     Print_Val("Part ID is: 0x", part_id);

     /* Read Part Unique Identification Number*/
     Chip_IAP_ReadUID(unique_id);
     DEBUGSTR("Unique Part ID is:\r\n");
     for (i=0; i<4; i++) {
          Print_Val("0x", unique_id[i]);
     }

     /* Disable interrupt mode so it doesn't fire during FLASH updates */
     __disable_irq();

     /* IAP Flash programming */
     /* Prepare to write/erase the last sector */
     ret_code = Chip_IAP_PreSectorForReadWrite(IAP_LAST_SECTOR, IAP_LAST_SECTOR);

     /* Error checking */
     if (ret_code != IAP_CMD_SUCCESS) {
          Print_Val("Command failed to execute, return code is: ", ret_code);
     }

     /* Erase the last sector */
     ret_code = Chip_IAP_EraseSector(IAP_LAST_SECTOR, IAP_LAST_SECTOR);

     /* Error checking */
     if (ret_code != IAP_CMD_SUCCESS) {
          Print_Val("Command failed to execute, return code is: ", ret_code);
     }

     /* Prepare to write/erase the last sector */
     ret_code = Chip_IAP_PreSectorForReadWrite(IAP_LAST_SECTOR, IAP_LAST_SECTOR);

     /* Error checking */
     if (ret_code != IAP_CMD_SUCCESS) {
          Print_Val("Command failed to execute, return code is: ", ret_code);
     }

     /* Write to the last sector */
     ret_code = Chip_IAP_CopyRamToFlash(START_ADDR_LAST_SECTOR, src_iap_array_data, IAP_NUM_BYTES_TO_WRITE);

     /* Error checking */
     if (ret_code != IAP_CMD_SUCCESS) {
          Print_Val("Command failed to execute, return code is: ", ret_code);
     }

     /* Re-enable interrupt mode */
     __enable_irq();

     /* Start the signature generator for the last sector */
     Chip_FMC_ComputeSignatureBlocks(START_ADDR_LAST_SECTOR, (SECTOR_SIZE / 16));

     /* Check for signature geenration completion */
     while (Chip_FMC_IsSignatureBusy()) {}

     /* Get the generated FLASH signature value */
     Print_Val("Generated signature for the last sector is: 0x", Chip_FMC_GetSignature(0));
        for(j=0;j<200;j++) for(k=0;k<65535;k++);
        DEBUGSTR("Enter UART ISP mode\r\n");
        Chip_IAP_ReinvokeISP();
     while (1) {
          //__WFI();
     }
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

After I enter ISP mode, I wait for about 30 minutes, then my code still in the ISP mode, I still can use the flashmagic to readout the device signature, the code didn't reset.

So, you also can use the official code and test it on your side.


Have a great day,
Kerry

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

0 项奖励
回复

2,367 次查看
ranjithshanbhag
Contributor III

Hi Kerry,

Thanks for your valuable reply.

I downloaded the official code from above link and programmed to NXP LPC82x Xpresso v2/mbed board. Unable to program or read out the device signature from Flash magic. Flash magic throwing error saying Failed to set autobaud. Please find the below screenshot or more details.

pastedImage_3.png

Please provide your thoughts on this, so i can move ahead.

Thanks in advance.

0 项奖励
回复

2,367 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Ranjith,

  Do you use my modified code?

  If yes, after you download the code to the chip, reset the chip, please wait for about 10 seconds, then use the flash magic to connect it again.

  As you know,  in my modified code, I add the delay, the loop wait, then enter ISP mode from the code.

  Actually, you also can check the printf information, when you get : Enter UART ISP mode\r\n

Then you can enter the ISP mode with flash magic.

Have a great day,
Kerry

 

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

0 项奖励
回复

2,367 次查看
ranjithshanbhag
Contributor III

Thanks a lot kerry or your valuable support.

It is working now.

0 项奖励
回复