ISP Entry Methods in MCX N5xx EVK

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

ISP Entry Methods in MCX N5xx EVK

Jump to solution
539 Views
Avinpat123
Contributor I

Hi, I am using an N5xx EVK. I need to enter into ISP mode so that I can make use of the default UART for flashing my user application via blhost . I want to trigger ISP entry through a software method instead of using hardware pins

I tried Hardware method that is working fine (by pressing ISP button then reset board) but i need software method 

when we access via blhost command response was not there 

Avinpat123_0-1755671846901.png

 

Tried code follows

typedef void (*pBootloaderEntry)(void *arg);

 

#define BOOTLOADER_API_TREE_ADDR (0x1301fc00u)

#define BOOTLOADER_API_ENTRY ((pBootloaderEntry)(*(uint32_t *)(BOOTLOADER_API_TREE_ADDR)))

 

void EnterISP(void)

{

PRINTF("Jumping to ROM bootloader...\r\n");

 

__disable_irq();

 

// Jump into bootloader (ISP mode)

BOOTLOADER_API_ENTRY(0);

}

/*

* @brief Application entry point.

*/

int main(void)

{

/* Init board hardware. */

BOARD_InitBootPins();

BOARD_InitBootClocks();

BOARD_InitBootPeripherals();

 

#ifndef BOARD_INIT_DEBUG_CONSOLE_PERIPHERAL

/* Init FSL debug console. */

BOARD_InitDebugConsole();

#endif

 

PRINTF("Hello World2\r\n");

PRINTF("Send 'd' for firmware upgrade\r\n");

/* Enter an infinite loop, just incrementing a counter. */

while(1)

{

char ch = GETCHAR();

if (ch == 'd')

{

PRINTF("jump to bootloader...\r\n");

EnterISP();

}

}

return 0 ;

}

Labels (1)
0 Kudos
Reply
1 Solution
516 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Avinpat123 

To enter ISP mode, please use the runBootloader API.

Alice_Yang_0-1755679363032.png

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 ISP Interface in arg.


#define ROM_API_TREE ((uint32_t*)0x1303fc00)

#define RUN_BOOTLOADER_API_TREE ((void (*)(void *)) ROM_API_TREE[0])

uint32_t arg = 0xEB120000; /*0xEB: represents Enter Boot; 0x12: represents enter ISP mode by UART only */

RUN_BOOTLOADER_API_TREE->runBootloader(&arg);


After the application image, which calls the above runBootloader API, has booted successfully, the device will only allow the UART interface to be connected to transfer the data with the host.

 

Thank you.

 

BR

Alice

 

 

View solution in original post

0 Kudos
Reply
2 Replies
517 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Avinpat123 

To enter ISP mode, please use the runBootloader API.

Alice_Yang_0-1755679363032.png

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 ISP Interface in arg.


#define ROM_API_TREE ((uint32_t*)0x1303fc00)

#define RUN_BOOTLOADER_API_TREE ((void (*)(void *)) ROM_API_TREE[0])

uint32_t arg = 0xEB120000; /*0xEB: represents Enter Boot; 0x12: represents enter ISP mode by UART only */

RUN_BOOTLOADER_API_TREE->runBootloader(&arg);


After the application image, which calls the above runBootloader API, has booted successfully, the device will only allow the UART interface to be connected to transfer the data with the host.

 

Thank you.

 

BR

Alice

 

 

0 Kudos
Reply
486 Views
Avinpat123
Contributor I

Hi, Alice_yang thanks for the fast reply the solution you have provided that is working fine 
and final code solution is written below.

1. I have one more question the information you have provided for bootloader API can we know in which doc it was defined can you just share me a link for that one.

// **ISP ROM API ADDRESS FOR MCX N5XX EVK**

#define ROM_API_TREE ((uint32_t*)0x1303fc00)

#define RUN_BOOTLOADER_API_TREE ((void (*)(void *)) ROM_API_TREE[0])

 

/* TODO: insert other definitions and declarations here. */

 

void EnterISP(void)

{

PRINTF("Entering ISP mode via software trigger...\r\n");

 

// **CRITICAL: Use structured argument as per NXP Bootloader API specification**

uint32_t arg = 0xEB120000;

/*

* 0xEB12 0000 breakdown:// for ISP in UART interface only

* 0xEB11 0000 breakdown:// for ISP in USB HID interface only

* 0xEB = Enter Boot (Tag field [31:24])

* 1 = Enter ISP mode (Boot Mode field [23:20])

* 1 = USB HID Interface (ISP Interface field [19:16])

* 2 = UART interface (ISP Interface field [19:16])

* 0000 = Reserved/Image Index fields

*/

__disable_irq();

 

// Call NXP ROM bootloader API with correct argument

RUN_BOOTLOADER_API_TREE(&arg);

 

// Should never reach here

while(1);

}

 
0 Kudos
Reply