I'm encountering an issue when trying to program or erase the MCXN236 using MCU-Link. Below is the log output:
Nc: Using SOFT reset to run the flash driver
Nc: Flash variant 'MCXNxxx (1024KB) (Secure)' detected (1MB = 128*8K at 0x10000000)
Nc: Closing flash driver MCXNxxx_S.cfx
Pc: ( 65) Chip Setup Complete
Pc: ( 70) License Check Complete
Nt: Loading 'GUI.bin' Binary 0x00000000 len 0x11068
Nc: Opening flash driver MCXNxxx.cfx
Nc: VECTRESET requested, but not supported on ARMv8-M CPUs. Using SOFTRESET instead.
Nc: Using SOFT reset to run the flash driver
Nc: Flash variant 'MCXNxxx (1024KB)' detected (1MB = 128*8K at 0x0)
Pb: 1 of 1 ( 0) Writing sectors 0-8 at 0x00000000 with 69736 bytes
Ps: ( 0) at 00000000: 0 bytes - 0/69736
Wc: failed read ChecksumSectors message readyness - rc Em(12). Target rejected debug access at location 0x040048D0
Wc: failed to send op EraseSector message - rc Em(12). Target rejected debug access at location 0x040048B8
Nc: Closing flash driver MCXNxxx.cfx
Nc: state - running or following reset request - re-read of state failed - rc Nn(05). Wire ACK Fault in DAP access
Wc: failed to send op Terminate message - rc Em(12). Target rejected debug access at location 0x040048B8
Pb: (100) Writing Flash ended with an error.
Ed:05: File 'GUI.bin' load failure: Em(12). Target rejected debug access at location 0x040048B8
Pc: (100) Target Operation Failed
Nc: error closing down debug session - Nn(05). Wire ACK Fault in DAP access
The ISP bootloader appears to be working. I can send commands to the memory using it but the code does not run after flashing.
@sstcor Check the image I hope this will help you still if you face any problem let me know.
Best Regards,
Ashutosh Nama.
@sstcor , Below is a sample flash script using blhost — NXP’s command-line tool for communicating with the bootloader — to fully erase and program the flash on an MCXN236 via ISP mode (UART or USB, depending on your setup).
If this works, your flash is now clean.
This writes your firmware to the start of flash (address 0x00000000) and then tells the MCU to execute from there.
Note: If your GUI.bin is an image from MCUXpresso or GCC, ensure it is a proper binary file and not in ELF or HEX format. If needed, convert with:
Before flashing, check that:
The first 8 bytes of GUI.bin contain a valid stack pointer and reset vector.
You're not configuring any memory regions (e.g., TrustZone, MPU) that might restrict access without properly initializing them.
If Secure Boot is enabled, the image is signed or provisioned correctly.
Would you like me to generate a minimal example main.c that’s safe to flash and test on the MCXN236?
Best Regards,
Ashutosh Nama
Absolutely @sstcor — here's a minimal working example of how to use blhost to:
Connect to the target in ISP (UART) mode.
Erase the flash memory.
Write a binary image.
Jump to the application.
-p COM5,115200 specifies UART port and baud rate (replace COM5 as needed).
0x0 is the start address for most MCUs (check your specific part).
Make sure the target is in ISP mode (boot pins or jumper set).
Let me know if you'd like a .bat script version or a Linux shell script.
Best Regards,
Ashutosh Nama.
I am getting this error when I enter the "execute" command.
@sstcor I'm running out of DMs can we connect over the call to solve this problem?
My mail address is: ashutoshnama26@gmail.com
Best Regards,
Ashutosh Nama
Dear @sstcor
This kind of issue is common when early development images misconfigure boot settings or lock debug access. Keeping ISP mode available and performing a full erase typically resolves it. Once erased, you should be able to regain normal debug access and proceed.
Let me know if you’d like a sample flash script or want help verifying your firmware image.
Best Regards,
Ashutosh Nama.
Hi Ashutosh, I tried erasing the microcontroller in ISP mode but no success. I still can't access the microcontroller using debug port.