MK02FN128 Flash programming

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MK02FN128 Flash programming

1,561件の閲覧回数
Cesare
Contributor I

Hi all,

I'm experiencing some strange problem trying to port the code of the application note AN2295 on an MK02FN128 cpu. I have to say that before this I successfully porte the same code on an MK21DN512, in this case all worked fine at first attempt.

With the MK02FN128, when I try to erase a sector or program a longword I always get an Access error in the FTFA_FSTAT register and I didn't find a way to avoid this.

Did anyone already try this kind of porting? The MK02FN128 uses FTFA as prefix of the flash register while the MK12 uses the FTFL, MK02 was not listed in the kinetis model supported by the application note so I had to select a KLXX model in order to use the right prefix for the flash register, I don't know if this kind of setting can have some drawback.

Cheers,

Angelo

ラベル(2)
0 件の賞賛
返信
6 返答(返信)

1,095件の閲覧回数
Cesare
Contributor I

Hi all,

things started working fine using the internal clock, don't know why but with the external clock I only got Access errors.

Cheers,

Angelo

0 件の賞賛
返信

1,095件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Angelo:

Good to see that you are moving forward.

Just as recommendation, if you are reusing AN2295 code then I would create a custom configuration file (AN2295_<my_K02_board>_cfg.h) and also make sure that the parameter macros from "kinetis_params.h" match your K02. While the KLxx models use the FTFA flash module there are differences between K02 and KL families such as:

1- Different scheme for output clock dividers in the SIM module.

2- Flash sector size (1 KB vs 2 KB).

Regards!

Jorge Gonzalez

0 件の賞賛
返信

1,095件の閲覧回数
mjbcswitzerland
Specialist V

Cesare

You need to use phrase programming rather than long word programming when working with the K02F.

The long word programming command is not valid.

Note that AN2295 mode is supported in the uTasker serial loader project, which works on all K, KL, KV, KW, KE and KEA parts (no compiler restrictions and no porting necessary - or mix with KBOOT SREC or SD card loading on K02F).

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html

Serial Bootloader (Ethernet, USB, MSD, KBOOT, AN2295, SREC, SD-card): http://www.utasker.com/forum/index.php?topic=1873.msg6796#msg6796 / http://www.utasker.com/docs/uTasker/uTaskerSerialLoader.PDF

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 件の賞賛
返信

1,095件の閲覧回数
Cesare
Contributor I

Hi Mark,

thank you for the reply, I'll give it a try.

But something is still not clear, first of all the only flash program operation listed in the K02 ref manual is the long word program, the phrase programming is not mentioned at all, furthermore I get the same error also when I try to erase a sector.

I'm going to do some test then I'll let you know.

Cheers,

Angelo

0 件の賞賛
返信

1,095件の閲覧回数
mjbcswitzerland
Specialist V

Angelo

I am sorry, but I made a mistake - it is the K21F120 that works with phrase programming and the K02F100 (as the K22and K24) that doesn't.

In fact the KL devices also use the long word programming and so should be compatible in this respect, so your selecting this makes sense.

Note however that the flash controller in the K02F100 has additional registers to control in which areas code can be executed from and whether supervisor or user modes can access it. Maybe this setting could explain something (?)

Regards

Mark

0 件の賞賛
返信

1,095件の閲覧回数
Cesare
Contributor I

Hi Mark,

the CPU that works fine is the MK12 not the MK21 as written above, my mistake.

Still I can't program the flash, actually every commands give me back an Access error, including the read 1s and read 1s all.

All the XACCn, SACCn and FPROTn registers are FF, the FSEC register is FE (2 least significant bits indicating that the MCU security status is unsecure).

I can't figure out what is going on.

Angelo

0 件の賞賛
返信