Entering ISP mode from application code in LPC55

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

Entering ISP mode from application code in LPC55

2,054 Views
yohannes_araya
Contributor I

MCU: LPC55S28 

Board: LPC55S28-EVK 

 

Following the user manual, I have the following code in my application to enter ISP mode but all it's doing is reset the system and start from the beginning of my application. Do any of the configurations inside CMPA/CFPA affect the ability to enter ISP mode. CMPA/CFPA are not currently configured (all zeros). Is there anything that needs to be set within my application before jumping to bootloader (runBootloader).

 

...

#include "fsl_iap.h"
...
int main()
{

    ...

    // ISP mode and USB only (LPC55 User Manual section 9.3.4: runBootloader API)
    uint32_t arg = 0xEB110000;  
    RunBootloader(&arg);

    while (1) {}
}

 

//////////////////////////////////////////////////////////////

I added RunBootloader declaration/definition in  fsl_iap.h/c:

 

void RunBootloader(void *arg)
{
    BOOTLOADER_API_TREE_POINTER->runBootloader(arg);
}

 

/////////////////////////////////////////////////////////////

fsl_iap already has the following definitions:

 

#define BOOTLOADER_API_TREE_POINTER ((bootloader_tree_t *)0x130010f0U)

 

typedef struct BootloaderTree
{
    void (*runBootloader)(void *arg);      /*!< Function to start the bootloader executing. */
    standard_version_t bootloader_version; /*!< Bootloader version number. */
    const char *copyright;                 /*!< Copyright string. */
    const uint32_t *reserved;              /*!< Do NOT use. */
    flash_driver_interface_t flashDriver;
} bootloader_tree_t;

Labels (1)
0 Kudos
3 Replies

707 Views
VChaudhary
Contributor III

Best Way to do it is as below:

LPC55S16 ROM bootloader provides an API for the user application to enter the ISP mode based on the designated ISP interface mode.
Prototype
void (*runBootloader)(void *arg);

VChaudhary_0-1679407225571.png

 



add the below code in fsl_iap.c:
#define BOOTLOADER_TREE_LOCATION(0x1301fe00)
bootloader_tree_t *romApiTree = (bootloader_tree_t *)BOOTLOADER_TREE_LOCATION;
void runBootloader(void *arg)
{
    romApiTree-> runBootloader(&arg);
}

then in the main, add:
uint32_t arg = 0xEB110000; // Boot in ISP and ISP interface will be USB-HID
runBootloader(arg);

After that ROM Bootloader will boot in ISP Mode, and you can flash through USB-HID.

Note: The above approach is tested and verified on LCD55S16.

0 Kudos

1,841 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Yohannes,

Hope you are doing well.

I believe this post will help you. Could you please try this solution and let me know if it works for you?

https://community.nxp.com/thread/508697 

Best Regards,

Sabina

-----------------------------------------------------------------------------------------------------------------------

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

----------------------------------------------------------------------------------------------------------------------- 

0 Kudos

1,841 Views
yohannes_araya
Contributor I

Thanks for the reply. I actually saw that specific post, and tried it before I submitted my question. Ultimately, I decided to implement a second-stage bootloader that mimics ISP mode and other functionalities that I need. The effort is worth it as it gave me full control over its features. It would still be interesting to know what it takes to enter ISP mode from application.

0 Kudos