Thursday, April 24th 2014, 8:41pm UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

mbeakes

Beginner

Date of registration: Mar 6th 2012

Posts: 6

1

Tuesday, March 6th 2012, 6:46pm

JLINK MK70FN1M0 TRST signal

Hi,

I'm working on K70TWR board with JLINK and CortexM connector.
Do I need to connect TRST from Legacy JTAG (pin 3) to CortexM connector pin 9 for that device ?
By looking at the schematic, I observed that the pin 9 is connected to K70 pin PTA4.
With a closer look at the schematic we can also observe that PTA5 is the TRST pin of the processor.

I'm asking these question because I'm able to to connect to the device and get CPU ID and see Cortex M4 displayed on JLink GDB server JTAG but I can't read and write to Flash memory.

Thanks.

mbeakes

Beginner

Date of registration: Mar 6th 2012

Posts: 6

2

Wednesday, March 7th 2012, 4:23am

Here are the other tests that I did.

JLink is able to write and read data to internal ram using Jlink commander w4 and mem32 command.

I observed that when trying to write to flash memory with w4 and reading it with mem32, I always reads it as 0xffffffff.
It's seems that the device is locked. When I saw that, I tried to unlock the device using "unlock kinetis".
Device still locked even after unlock command.

Is the unlock command supports kinetis mk70kn1m0xxx12 devices ?

Thanks.

SEGGER - Alex

Super Moderator

Date of registration: Dec 18th 2007

Posts: 1,154

3

Wednesday, March 7th 2012, 10:25am

Hi,

Quoted

Device still locked even after unlock command.

I do not think so...
If a Kinetis device is locked / secured we can NOT connect to it and so we can NOT read/write memory.
(Otherwise the security would be useless...)

The w4 command performs a simple write to memory. As long as no device has been explicitly selected
by the "exec device = ..." command, the memory that is written by the w4 command is assumed to be RAM.

I am a bit confused what is the problem right now...
In the title of the thread you initially asked about the TRST signal.
Then in your first post you wrote that flash programming via GDBServer does not work.
Now you write that everything basically seems to work but flash programming via J-Link Commander does not and that your device is possibly locked (which can not be the case since then basic operations would also NOT work).

Did you have a look in UM08001, chapter "Flash download", section "Setup for various debuggers (internal flash)"?
There are some steps required to enable programming of the internal flash of a device.


Best regards
Alex

mbeakes

Beginner

Date of registration: Mar 6th 2012

Posts: 6

4

Wednesday, March 7th 2012, 6:34pm

Hi Alex,

I agree that it's confusing. The issue is that I'm unable to program the application into internal flash.

Below is the history of the issue that will help you understand the questions that I asked (it was confusing ) and after you will find the steps that i did to program the device.


Issue History
Here is a brief history why :
At first I asked if TRST needs to be connected to the CPU because I taught it was the issue. (that where the thread title comes from)
After I investigate the issue and figured out that I was able to read/write in internal ram and also that JLINK JTAG recognized the device as Cortex M4.
The conclusion of that is that all signals are properly connected to CPU because I can read/writre into ram and Jlink recognized the CPU.
After that, I used Jlink Commander to "unlock kinetis" because I thought that it was the issue (device locked) because the program can't be write in internal flash.

Issue
The issue is that I can't write the application into flash memory using the following steps.

Here is the script that I run to dowload the application "blinky.elf" into internal flash:
1- First , I start Jlink Gdb server
2- I type the following command using arm-none-eabi-gdb

target remote localhost:2331
monitor interface JTAG
monitor endian little
monitor speed auto
monitor reset
monitor flash device = MK70FN1m0xxx12
monitor flash download = 1
load blinky.elf

At this point, a the flash download popup screen appears at remains on screen for ever.

Hope this help to understand.
Thanks

This post has been edited 2 times, last edit by "mbeakes" (Mar 7th 2012, 8:13pm)


SEGGER - Alex

Super Moderator

Date of registration: Dec 18th 2007

Posts: 1,154

5

Thursday, March 8th 2012, 10:28am

Hi,

Indeed this does help.
Can you provide the blinky.elf so we can reproduce this here?
We also have a K70TWR here.


Best regards
Alex

mbeakes

Beginner

Date of registration: Mar 6th 2012

Posts: 6

6

Monday, March 12th 2012, 1:43pm

Hi,

It looks that the issue was not related to the application by itself.
I tried to load a demo project from Freescale and I got the same result (the popup that shows programmation progress remains on screen).
I tried the following based on your suggestion and UM08001 p.150 :
1- convert the application to binary file ex: blinky.bin
2-open JLink commander and type the following commands:
exec device = mk70fn1m0xxx12
loadbin blinky.main,0x00000000

As soon as I typed these command, the bin was loaded into the device.
By typing mem32, I was able to read the internal flash and confirm that the bin was loaded in internal flash.

Now I can write/read internal flash memory.
I didn't really understand why it starts working after using loadbin.

Now when I use arm-none-eabi-gdb, I'm able to write/read internal flash memory.

SEGGER - Alex

Super Moderator

Date of registration: Dec 18th 2007

Posts: 1,154

7

Thursday, March 15th 2012, 10:24am

Hi,

Now I am confused again...
Can you simply provide something that can be used to reproduce the problem you were seeing (flash programming window does not close)?
Ideally it is just an ELF file, we can use to reproduce this.
We would REALLY like to understand
a) Where this problem comes from.
b) How to fix it.


Best regards
Alex

mbeakes

Beginner

Date of registration: Mar 6th 2012

Posts: 6

8

Wednesday, March 21st 2012, 11:59pm

K70 program issue

Hi,

Here is a simple .elf file who includes boot code.
This .elf file is a simple boot code that i used for the K70 TWR board.
This application does nothing special, it setup vector table, flash config bits and copy flash content to internal ram and then jump into the main loop.
The main loop includes some line of code only to test if I can step in the code using the JTAG.

As I mentionned before, when I had the issue, I wasn't hable to program the board at all. The progress window (the one that contains 3 progress bars that indicates the download status) remains on screen and the progress bars didn't moved.
Since the first time that I programmed the device successfully, it's working fine and the issue never showed up again.

Hope this will help.
mbeakes has attached the following file:
  • main.zip (3.5 kB - 127 times downloaded - Last download: Apr 21st 2014, 7:14pm)