how to flash a KL26 with no crystal?

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

how to flash a KL26 with no crystal?

2,221 Views
robotjosh
Contributor IV

I have used many kinetis chips but this is the first design that has no crystal.  It is intended to use the internal oscillator.  It is not possible to flash any of these units without the crystal.  They continuously put themselves in reset resulting in a series of pulses on the reset pin.  This results in the orange light on the jlink.  When I try to flash the jlink blinks red.  The jlink can connect but gives an error when any memory is attempted to be read or written.  What could be the problem?  Is it possible to use the KL26 with only the internal oscillator?

Labels (1)
0 Kudos
Reply
6 Replies

1,743 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Josh,

As Mark mentioned above, there's no difference to program the KL26 between integrate with the external crystal and use the internal oscillator.

I'd like to suggest that you'd better check the debug interface by referring to the attachment.

And I was wondering if you can tell which IDE you use and and share the screenshot of the error message.
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,743 Views
robotjosh
Contributor IV

I tried adding a pullup to SWD_DIO as in the diagram, same results.  IAR isn't an option, we are using kinetis design studio 3.

0 Kudos
Reply

1,743 Views
robotjosh
Contributor IV

I tried reducing the debug clock to 20khz.  Here is the log-

SEGGER J-Link GDB Server V5.02d Command Line Version

JLinkARM.dll V5.02d (DLL compiled Sep 18 2015 20:21:49)

-----GDB Server start settings-----

GDBInit file:                  none

GDB Server Listening port:     2331

SWO raw output listening port: 2332

Terminal I/O port:             2333

Accept remote connection:      localhost only

Generate logfile:              off

Verify download:               on

Init regs on start:            on

Silent mode:                   off

Single run mode:               on

Target connection timeout:     0 ms

------J-Link related settings------

J-Link Host interface:         USB

J-Link script:                 none

J-Link settings file:          none

------Target related settings------

Target device:                 MKL26Z128xxx4

Target interface:              SWD

Target interface speed:        20kHz

Target endian:                 little

Connecting to J-Link...

J-Link is connected.

Firmware: J-Link V9 compiled Sep 18 2015 19:53:12

Hardware: V9.30

S/N: 59304847

Feature(s): GDB

Checking target voltage...

Target voltage: 3.36 V

Listening on TCP/IP port 2331

Connecting to target...Connected to target

Waiting for GDB connection...Connected to 127.0.0.1

Reading all registers

Read 4 bytes @ address 0x00000000 (Data = 0xFFFFFFFF)

Target interface speed set to 1000 kHz

Resetting target

Halting target CPU...

...Target halted (PC = 0xFFFFFFFE)

R0 = 7FFFDDFD, R1 = FFFFFEDF, R2 = CFDD1DFF, R3 = EFFF7BFF

R4 = BEFDDFFF, R5 = FF5FF7FD, R6 = FFDFFC7F, R7 = FBDFFFFE

R8 = BFFBFDFE, R9 = FD14DFAF, R10= FFAFFFE7, R11= CFDFF6F7

R12= 7DFFFFEF, R13= FFFFFFFC, MSP= FFFFFFFC, PSP= FFFEFFFC

R14(LR) = FFFFFFF9, R15(PC) = FFFFFFFE

XPSR F1000000, APSR F0000000, EPSR 01000000, IPSR 00000000

CFBP 00000000, CONTROL 00, FAULTMASK 00, BASEPRI 00, PRIMASK 00

Reading all registers

Select auto target interface speed (2000 kHz)

Flash breakpoints enabled

Semi-hosting enabled (Handle on BKPT)

Semihosting I/O set to TELNET Client

SWO disabled succesfully.

ERROR: Failed to preserve original RAM content before CPU clock frequency detection!

Failed to restore original RAM content after CPU clock frequency detection!

Failed to enable SWO. Could not measure target CPU frequency.

Downloading 192 bytes @ address 0x00000000 - Verified OK

Downloading 16 bytes @ address 0x00000400 - Verified OK

Downloading 2480 bytes @ address 0x00000410 - Verified OK

Downloading 8 bytes @ address 0x00000DC0 - Verified OK

Downloading 4 bytes @ address 0x00000DC8 - Verified OK

Downloading 4 bytes @ address 0x00000DCC - Verified OK

Downloading 96 bytes @ address 0x00000DD0 - Verified OK

Downloading 24 bytes @ address 0x00000E30 - Verified OK

ERROR: Failed to download RAMCode.

Failed to download RAMCode!

Writing register (PC = 0x000006d0)

Read 4 bytes @ address 0x000006D0 (Data = 0xFFFFFFFF)

Read 2 bytes @ address 0x00000514 (Data = 0xFFFF)

Read 2 bytes @ address 0x00000514 (Data = 0xFFFF)

Resetting target

Halting target CPU...

...Target halted (PC = 0xFFFFFFFE)

Read 2 bytes @ address 0x00000514 (Data = 0xFFFF)

Read 2 bytes @ address 0x00000514 (Data = 0xFFFF)

Read 2 bytes @ address 0x00000514 (Data = 0xFFFF)

R0 = 7FFFDDFD, R1 = FFFFFEDF, R2 = CFDD1DFF, R3 = EFFF7BFF

R4 = BEFDDFFF, R5 = FF5FF7FD, R6 = FFDFFC7F, R7 = FBDFFFFE

R8 = BFFBFDFE, R9 = FD14DFAF, R10= FFAFFFE7, R11= CFDFF6F7

R12= 7DFFFFEF, R13= FFFFFFFC, MSP= FFFFFFFC, PSP= FFFEFFFC

R14(LR) = FFFFFFF9, R15(PC) = FFFFFFFE

XPSR F1000000, APSR F0000000, EPSR 01000000, IPSR 00000000

CFBP 00000000, CONTROL 00, FAULTMASK 00, BASEPRI 00, PRIMASK 00

Reading all registers

WARNING: Failed to read memory @ address 0xFFFFFFFE

Setting breakpoint @ address 0x00000514, Size = 2, BPHandle = 0x0001

Starting target CPU...

ERROR: Can not read register 15 (R15) while CPU is running

...Target halted (PC = 0x00000000)

Reading all registers

ERROR: Can not read register 0 (R0) while CPU is running

ERROR: Can not read register 1 (R1) while CPU is running

ERROR: Can not read register 2 (R2) while CPU is running

ERROR: Can not read register 3 (R3) while CPU is running

ERROR: Can not read register 4 (R4) while CPU is running

ERROR: Can not read register 5 (R5) while CPU is running

ERROR: Can not read register 6 (R6) while CPU is running

ERROR: Can not read register 7 (R7) while CPU is running

ERROR: Can not read register 8 (R8) while CPU is running

ERROR: Can not read register 9 (R9) while CPU is running

ERROR: Can not read register 10 (R10) while CPU is running

ERROR: Can not read register 11 (R11) while CPU is running

ERROR: Can not read register 12 (R12) while CPU is running

ERROR: Can not read register 13 (R13) while CPU is running

ERROR: Can not read register 14 (R14) while CPU is running

ERROR: Can not read register 15 (R15) while CPU is running

ERROR: Can not read register 16 (XPSR) while CPU is running

ERROR: Can not read register 17 (MSP) while CPU is running

ERROR: Can not read register 18 (PSP) while CPU is running

ERROR: Can not read register 24 (PRIMASK) while CPU is running

ERROR: Can not read register 25 (BASEPRI) while CPU is running

ERROR: Can not read register 26 (FAULTMASK) while CPU is running

ERROR: Can not read register 27 (CONTROL) while CPU is running

Removing breakpoint @ address 0x00000514, Size = 2

Read 4 bytes @ address 0x00000000 (Data = 0xFFFFFFFF)

Read 4 bytes @ address 0x00000000 (Data = 0xFFFFFFFF)

0 Kudos
Reply

1,743 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Josh,

I'd like to suggest the following steps to unsecure the chip, then try again.

1. Open the Jlink commander;

2. Input the commander:unclok the kinetis;

Have a great day,

Ping

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,743 Views
robotjosh
Contributor IV

Here is the jlink commander log of trying to erase after the "unlock Kinetis" command.  It stops going into a reset loop at this point but still cannot read or write memory.  If I try to debug with kds at this point it will go back to the reset loop and do the same as before.

J-Link>unlock Kinetis

Unlocking device...O.K.

J-Link>erase

Info: Found SWD-DP with ID 0x0BC11477

Info: Found SWD-DP with ID 0x0BC11477

Info: Found Cortex-M0 r0p0, Little endian.

Info: FPUnit: 2 code (BP) slots and 0 literal slots

Info: CoreSight components:

Info: ROMTbl 0 @ F0002000

Info: ROMTbl 0 [0]: FFFFE000, CID: B105900D, PID: 000BB932 MTB-M0+

Info: ROMTbl 0 [1]: FFFFF000, CID: B105900D, PID: 0008E000 MTBDWT

Info: ROMTbl 0 [2]: F00FD000, CID: B105100D, PID: 000BB4C0 ROM Table

Info: ROMTbl 1 @ E00FF000

Info: ROMTbl 1 [0]: FFF0F000, CID: B105E00D, PID: 000BB008 SCS

Info: ROMTbl 1 [1]: FFF02000, CID: B105E00D, PID: 000BB00A DWT

Info: ROMTbl 1 [2]: FFF03000, CID: B105E00D, PID: 000BB00B FPB

Info: Kinetis L-series (setup): Disabling watchdog.

Erasing device (MKL26Z128xxx4 (allow security))...

****** Error: Failed to prepare for programming.

Could not read target memory.

Please check your flash settings!

****** Error: Failed to prepare for programming.

Could not read target memory.

Please check your flash settings!

ERROR: Erase returned with error code -1.

J-Link>

0 Kudos
Reply

1,743 Views
mjbcswitzerland
Specialist V

Josh

Whether there is a crystal or not in the circuit doesn't affect the way that programming takes place; an erased chip will always be runing from the internal oscillator and the external one will not be enabled.

I would try reducing the JLink clock speed setting to see whether it makes a difference.

Also try using different programming tools - I have experienced cases where (for example) IAR and JLink wouldn't work together in some circumstances but Codewarrior and JLink would. I could then get IAR + JLink operating again by commanding a chip erase with CW + JLink, then a chip erase with IAR + JLink and after all was fine again (until loading certain code, when it would again stop operating).

Somethings are difficult to explain but I can't imagine the crystal being there or not to be a reason for a programming issue.

Regards

Mark

0 Kudos
Reply