I am using the LPC5526 (NON-S) and want to re-enter the serial (uart) bootloader by a call from my program.
The ISP and SWD pins are not accessible (in the final product) and both will be locked out security bits in the future (to prevent possible readout).
Reading through the User manual: 9.3.4 runBootloader API mentions exactly what i need.
However this does not work.
The example below doesn't respond to a serial program (tested with Flashmagic) and when i suspend the program it is halted in an "HardFault_Handler"
If i use the alternative location from the fsl_iap the program just reboots.
And finaly using the undocumented NXP forum suggestion also just reboots.
Short: Is it possible to jump to the UART ISP bootloader direct from my program? or do i have to do something before jumping? like turning off interrupts?
Example: In the application image boot process, regardless of whether the ISP pin is
connected to the high level, the device will directly enter the ISP mode through the UART
interface according to the parameter ispInterface in arg.
//Version 2.1.4.
// from fsl_iap.c: LPC5528_SERIES -> #define BOOTLOADER_API_TREE_POINTER ((bootloader_tree_t *)0x130010f0U)
// other LPC550x & LPC551x series -> #define BOOTLOADER_API_TREE_POINTER ((bootloader_tree_t *)0x1301fe00U)
////#define BOOTLOADER_TREE_LOCATION (0x130010f0U) // from fsl_iap.c: LPC5528_SERIES ??
#define BOOTLOADER_TREE_LOCATION (0x1301fe00) // from ROM_API.PDF / User Manual
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 reserved0; /*!< Do NOT use. */
// flash_driver_interface_t flashDriver;
// const kb_interface_t *kbApi; /*!< Bootloader API. */
// const uint32_t reserved1[4]; /*!< Do NOT use. */
// const skboot_authenticate_interface_t *skbootAuthenticate; /*!< Image authentication API. */
} bootloader_tree_t;
bootloader_tree_t *romApiTree = (bootloader_tree_t *)BOOTLOADER_TREE_LOCATION;
uint32_t arg = 0xEB120000; //0xEB: represents Enter Boot; 0x12: represents enter ISP mode by UART only
void EnterBootLoader(void)
{
ReadChipUUID();
#if (true)
// official NXP method
romApiTree->runBootloader(&arg);
#else
// Undocumanted NXP forum solution (not working, just reboots)
PMC->AOREG1 |= (0x0A << 16); //Set to boot from ROM
NVIC_SystemReset(); //Reset
#endif
for(;;)
{
}
};
Solved! Go to Solution.
Hi,
I suppose that this is a bug described in errata.pdf
Pls download the errata of LPC552x from the link:
https://www.nxp.com.cn/docs/en/nxp/errata/LPC55S2x_LPC552x_ES.pdf
I suppose that the PIO0_5 pin must be high when you execute the code:
PMC->AOREG1 |=(0X0A <<16);
NVIC_SystemReset();
Hope it can help you
BR
XiangJun Rong
Thank you for your fast response.
Indeed it seems the "undocumented" part was from the errata pdf clearly writing the issue of the not working API ISP mode.
I still don't know how i could miss that point from the ES as i often look for the latest version and scan for possible problems.
However the ES fix was also in my source and tested without success on one of our prototypes (development boards).
On our new boards we have a pullup resistor connected to the P0_5 pin and on those boards the ES fix works as expected.
Thank you!
Hi,
I suppose that this is a bug described in errata.pdf
Pls download the errata of LPC552x from the link:
https://www.nxp.com.cn/docs/en/nxp/errata/LPC55S2x_LPC552x_ES.pdf
I suppose that the PIO0_5 pin must be high when you execute the code:
PMC->AOREG1 |=(0X0A <<16);
NVIC_SystemReset();
Hope it can help you
BR
XiangJun Rong