Problems when programming the MKL04Z8VLC using Jlink and CW.

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

Problems when programming the MKL04Z8VLC using Jlink and CW.

2,325 Views
atwoz
Contributor I

We have been using the freedom board to evaluate the kinetis L series MCU's and they work fine. We now created the hardware required for our new product and it uses a MKL04Z8VLC4. We are using the JLink programmer from Segger. First of all, we tried using processor expert and CW 10.4 but we always get a hardfault. This only happens with the MKL04Z8VLC4 and not with the MKL05Z32.. We then wrote the code from scratch without using Processor expert and were able to run the program inside the MCU (MKL04Z8VLC4) but after the first or second programming it's not possible to reprogram the MCU, we have to switch to a fresh untouched MCU.

The error message I get is the following: "Failed to resume target process., ARM GDI Protocol Adapter : An error occurred while trying to write memory. The Debugger can not write memory."

What could be the issue?

Thanks.

Labels (1)
0 Kudos
12 Replies

1,336 Views
vitaliykoshelev
Contributor I

Hello, I have similar problem - I cant programming virgin mkl05 chip with j-link. The same thing with reset pin, and I havn't freedom board. I'm removed capacitor from reset pin, add pull-up 10K. I'm tried add pull-up 10K for SWDIO and nmi_b (ptb5) , and pull-down 10K for SWDCLK - no results. In CW10.7 tried "erase whole device" with fixed speed 100khz . Here is my log:

fl::target -lc "LC for Simple Flash"
fl::target -b 0x1ffffc00 0x1000
fl::target -v off -l off
cmdwin::fl::device -d "FTFA_PFlash32RAM4" -o "8kx32x1" -a 0x0 0x7fff
cmdwin::fl::erase all
Beginning Operation ...
-------------------------
Performing target initialization ...
failed on register write: LR
failed on register write: BP_COMP0
failed on register write: BP_COMP1
failed on register write: DEMCR
failed on register write: DWT_FUNCTION0
failed on register write: DWT_FUNCTION1
Device FTFA_PFlash32RAM4 is protected
Error: Couldn't write applet to target. Can not read target memory at location: 0x000000001FFFFC00.Please make sure that the chip selects are properly configured.
The CWPP response code is: ARM GDI Protocol Adapter : An error occurred while trying to write memory. The Debugger can not write memory..
Device FTFA_PFlash32RAM4 is protected
An error occurred while trying to write memory. The Debugger can not write memory.(ARM GDI Protocol Adapter)
Error: Couldn't write applet to target.Can not read target memory at location: 0x000000001FFFFC00.
Please make sure that the chip selects are properly configured.
The CWPP response code is: ARM GDI Protocol Adapter : An error occurred while trying to write memory. The Debugger can not write memory..

The problem is solved?

0 Kudos

1,336 Views
fishwang
Contributor I

Hi Vitaliy, Could you solved this problem? if yes, could you please help to share the solution to me as I have this problem now

0 Kudos

1,336 Views
atwoz
Contributor I

I connected the Reset, SWDIO, and SWDCLK to an oscilloscope to check what's going on. There is data in the IO line and a CLK, but the reset is behaving in a strange way. I connected a KL05 to the programmer and I noticed the reset line is always high and everything works ok, I'm able to program and debug the KL05. When I connect the KL04, I'm seeing a strange behavior in the reset line, coming from the KL04. The KL04 is always sending a pulse in the reset line @ 28kHz with a width of 2.5uS, even if I disconnect the Jlink. Is this normal?

0 Kudos

1,336 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

The SWD debugger circuit cause this issue.
Please check your SWD debug circuit, the FRDM-KL05Z board is using 1uF capacitor with reset pin. Please replace this capacitor with a smaller value just lik 0.1uF. And it will be recommend to add a 4.7 kΩ to 10 kΩ pull-up resistor with reset pin.

Your mentioned the reset pin always generate a pulse is a normal behavior, the pulse is generate caused by unprogrammed chip with incorrect instruction cause the chip reset.
If it is possible, you could remove the 0.1uF capacitor with reset pin and only left external 4.7kΩ or 10kΩ pull-up resistor.
Please try if the J-Link could connect/program with KL04 chip.

Wish it helps.

1,336 Views
atwoz
Contributor I

Thanks Hui.

Actually. I don't have any capacitor in the reset pin. I just have a 10k pullup. I'm trying to program using the Jlink since it's the only programmer I have.

Im getting the following errors in CW 10.4 when trying to debug.

Executing Initialization File: D:\CodeWarrior Workspace\project/Project_Settings/Debugger/init_kinetis.tcl

radix x

cmdwin::eclipse::config hexprefix 0x

cmdwin::eclipse::config MemIdentifier p

cmdwin::eclipse::config MemWidth 32

cmdwin::eclipse::config MemAccess 32

cmdwin::eclipse::config MemSwap off

cmdwin::reg User\/System Mode Registers/LR = 0xFFFFFFFF

failed on register write: LR

cmdwin::reg Breakpoint Unit Registers/BP_COMP0 = 0x0

failed on register write: BP_COMP0

cmdwin::reg Breakpoint Unit Registers/BP_COMP1 = 0x0

failed on register write: BP_COMP1

cmdwin::reg Core Debug Registers/DEMCR = 0x1000001

failed on register write: DEMCR

cmdwin::reg Data Watchpoint and Trace Unit Registers/DWT_FUNCTION0 = 0x0

failed on register write: DWT_FUNCTION0

cmdwin::reg Data Watchpoint and Trace Unit Registers/DWT_FUNCTION1 = 0x0

failed on register write: DWT_FUNCTION1

I'm able to program the KL05 using Jlink, not the kl04. However I was able to program like 4 chips once, now I can't program even the new chips (I have 100 new chips to test)

Thanks.

0 Kudos

1,336 Views
Hui_Ma
NXP TechSupport
NXP TechSupport


Hi,

I double checked with Kinetis L product engineer and get a info below:

CodeWarrior MCU V10.4 with incorrect KL04Z8 chip flash program algorithm, please use attached updated algorithm file instead of previous one.

CodeWarrior will fix this problem at next released version.

The file copy path is: CodeWarrior instalation path\MCU\bin\plugins\support\ARM\gdi\P&E directory.

Wish it helps.

B.R.

Ma Hui

0 Kudos

1,336 Views
atwoz
Contributor I

Thanks for the file Hui. But I am using JLink as a programmer and I believe the file you sent is for the P&E Programmer.

I get errors when I don't use CW and I use JLink.exe to try to unlock or erase the kinetis (I'm able to unlock and erase a kinetis KL05 on a freedom board but not the KL04 alone).

I have the minimum connections to the MCU, nothing more:

  1. Vdd to Vdd (3.3V)
  2. Gnd to Gnd
  3. JLINK nReset to the Reset of the MCU
  4. JLINK VRef to Vdd
  5. JLINK Gnd to Gnd
  6. JLINK SWDIO to SWDIO of the MCU
  7. JLINK WDCLK to SWCLK of the MCU
  8. A 10k resistor between Vdd and Reset
0 Kudos

1,336 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Could you try to add a 10K pull up resistor with SWDIO pin? If there still with problem, could you post the J-Link Commander software print info? It will show if J-Link find a device and related info. I attached my screen copy for your reference.

J-Link Commander.jpg

0 Kudos

1,336 Views
atwoz
Contributor I

Hello Hui,

I added the resistor. No luck.

Here are 2 screenshots, one with the direct connection to the KL04 MCU and one connected to the freedom board using the Jtag header.

1) First screen is the KL04MCU connected directly to the JLINK (it has a pullup in the reset and the SWDIO line)

jlink-commander-output-kinetis.JPG.jpg

2) Second screen is the connection to the freedom board.

jlink-commander-freedom.JPG.jpg

0 Kudos

1,336 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I checked your hardware connection, there without any problem.

Have you check if there exists rosin joint on your board?

And I check you are using FRDM-KL05 board to do the J-Link connection test.

Do you have tried to replace KL04 chip on your board with KL05 chip? If KL05 chip mounted on your board could be connected?

Please let me know your comments.

Thank you..

B.R.

Ma Hui

0 Kudos

1,336 Views
atwoz
Contributor I

Hello Hui. I have tried also with a KL05 connected directly to the JLINK with the components I mentioned (with PCB and also with wires soldered directly to the MCU) and no luck. I will try removing the KL05 from one of my freedom boards an soldering a KL04 to the freedom board and seeing if I could program that mcu using that board with the jlink.

I will let you know how it goes.

Thanks Hui.

0 Kudos

1,336 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I am checking with this issue, I will be back when I could get any updated info.

Thank you for the patience.

B.R.

Ma Hui

0 Kudos