MCUXpresso can't program flash on K02L064

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

MCUXpresso can't program flash on K02L064

2,121 Views
sariley
Contributor I

I have a bare board with the MK02FN64. I am using Segger J-Link and MCUXpresso. I can erase, program and read the MCU flash using Segger's J-Link applications.This implies the device and connections are correct.

MCUXpresso's debugger fails to program the flash & results in a Break at address that is outside the program code (not surprising since the flash was never programmed). The GUI Flash Tool also fails to erase or program the flash.

The Console information indicates that the J-Link is connecting to the device. I do notice that when using the Segger J-Link app, I get a message that the Protection bytes in flash at addr. 0x400-0x40F indicate that readout protection is set (don't know how to disable this in MCUXPresso ?? Using the GUI Flash Tool for Resurrecting locked Kinetis devices doesn't have any effect). Within Segger's app, I can unsecure the device & program it. I can can then read the content & verify it. MCUXpresso does nothing to the flash.

0 Kudos
12 Replies

1,781 Views
sariley
Contributor I

The hot patched failed. I don't see a way to add a file to this thread.

0 Kudos

1,781 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

Please try to reinstall MCUXpresso.

Please also try ulink(CMSIS-DAP) or Multilink.

Regards,

Jing

0 Kudos

1,781 Views
sariley
Contributor I

Jing,

I added the pull up & MCUXpresso still does not connect to the device with the J-Link. I again confirmed that both the Segger applications and IAR Embedded Workbench can access (ease, program and debug) the MK02FN64, but MCUXpresso can not. Here is the error message.

Error in final launch sequence:

Failed to execute MI command:
-target-select remote localhost:2331

Error message from debugger back end:
localhost:2331: No connection could be made because the target machine actively refused it.
Failed to execute MI command:
-target-select remote localhost:2331

Error message from debugger back end:
localhost:2331: No connection could be made because the target machine actively refused it.
localhost:2331: No connection could be made because the target machine actively refused it.

0 Kudos

1,781 Views
lpcxpresso_supp
NXP Employee
NXP Employee

As far as I can tell from the error messages, JLink GDB server wasn't started, so the GDB client fails to open a connection. Please note that there was a recent hotfix affecting debug via JLink - see MCUXpresso IDE v11.0.1 Segger-LPC Debug Hotfix. It's worth trying the patch and see if the connectivity problem you have gets fixed.

If problem persists after installing the recent patch, I'd recommend checking the path to the JLink GDB server (Window => Preferences =>  MCUXpresso IDE => J-Link Options) and whether that app can be executed. You could also try recreating your debug launch configuration. By the way, is your probe discovered during the auto-discovery sequence (Shift + Click the Debug button in Quickstart panel)?

It would be also useful to send us the .log file from .metadata inside your workspace folder. Moreover, check all the consoles for any JLink-related details.

Greetings,
MCUXpresso IDE Support

0 Kudos

1,781 Views
sariley
Contributor I

Attached is the schematic. There is no NMI pin on this package. The reset is pulled up & goes to the ARM 10 pin debugging header.

pastedImage_1.png

0 Kudos

1,780 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

In MK02FN64VLF10, PTA4 is the NMI_b pin. Please try to add a 4.7k~10k pull-up resistor. More important, it mustn't have any capacitor on this pin. Please also add a pull-up resistor on SWDIO pin.

Regards,

Jing

0 Kudos

1,780 Views
sariley
Contributor I

I then tried a PE Micro Multilink.

It too doesn't work with MCUX:

Error loading .ARP file : C:\nxp\MCUXpressoIDE_11.0.0_2516\ide\plugins\com.pemicro.debug.gdbjtag.pne_4.1.3.201905161939\win32\gdi\P&E\supportFiles_ARM\NXP\K0x\freescale_k02fn64m10_1x32x16k_pflash.arp at address 1FFFE000
Error loading programming algorithm - load aborted.
Error occured during Flash programming.
All Servers Running
Target Disconnected.

0 Kudos

1,780 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

Can you show me the RESET pin and NMI pin connection?

Regards,

Jing

0 Kudos

1,780 Views
sariley
Contributor I

Version is: MCUXpresso IDE v11.0.0 [Build 2516] [2019-06-05]

Yes, MCUX does find the J-Link debugger.

It runs the unlock function without complaining:

Unlocking device...O.K.
Script processing completed.

Erase works (confirmed with J-Mem app)

But programming & debug do not:

There was different behavior today, with the following:

Error in final launch sequence:

Failed to execute MI command:
-exec-run
Error message from debugger back end:
Don't know how to run. Try "help target".
Failed to execute MI command:
-exec-run
Error message from debugger back end:
Don't know how to run. Try "help target".
Don't know how to run. Try "help target".

Also, when GUI Flash tool is used:

pastedImage_1.png

0 Kudos

1,781 Views
sariley
Contributor I

Thank Jing for the information.

The details above were describing some observation. The root problem is that MCUXpresso is not erasing or programming the K02L064. It does not indicate any errors, but simply doesn't perform the operation. When debugging with the J-Link, MCUXpresso "goes through the motions", posts no errors, but doesn't erase or program the device. The debugging session never stops at 'main()', since it doesn't exist as it wasn't programmed.The J-Link works fine with Segger apps and works fine with IAR. If MCUXpresso were to post an error, it may be easier to troubleshoot.

0 Kudos

1,781 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

What is your MCUXpresso version?

When you use MCUXpresso download code, can it find Jlink debugger?

If it fail to download, it should display something. Is there really nothing happened?

Before download, MCUXpresso will attempt to unlock MCU. You can see it in Debug Configurations

pastedImage_1.png

Regards,

Jing

0 Kudos

1,781 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Steven,

In MCUXpresso, there isn't a special command can be used to erase secure state. A normal erase or mass erase can unsecure the device. Please check the startup_xxxxx.c which is in startup directory. There is a const struct Flash_Config. It should be

Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE};

This value will be written into 0x400~0x40F during program.

Regards,

Jing

0 Kudos