Is it possible to write to flash during runtime on the MKL16Z64

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

Is it possible to write to flash during runtime on the MKL16Z64

1,987件の閲覧回数
glenire
Contributor I
  1. Is it possible to write to flash during runtime on the MKL16Z64?
  2. Are there drivers/HAL for writing to Flash?
  3. Is there example code provided?
ラベル(1)
0 件の賞賛
返信
2 返答(返信)

1,912件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

Hi Glen,

Please read section 27.4.5 and 27.4.6 first. Reading from program flash memory space while a flash command is active is not allowed. When the flash is programming, MCU can't get next code from Flash. This will cause hardfault.

There is flash demo in KL16 SDK (SDK_2.2.0_MKL16Z64xxx4.zip\boards\frdmkl26z\driver_examples\flash\pflash). You can see that is code is execute in flash too. This is because before it trig flash erase/program command, it will copy a small piece of code to ram. This code will write CCIF register to launch the command and wait till command finish.

So, please refer to the pflash example and use this code directly. Flash can't program in VLPR mode. And please disable all interrupt before erase/program flash. This is because if interrupt happened during flash operation, MCU will read flash for interrupt vector address and service code. This will cause hardfault.

Regards,

Jing

0 件の賞賛
返信

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

Hi

See
https://www.utasker.com/kinetis/FRDM-KL26Z.html

You can use Flash for file system, logging of parameter system and the SDK will certainly have flash drivers for the device.

If you want a complete solution just use the open source uTasker project since it includes these as standard and allows simulation of the KL26(16), including its flash and other peripherals.
https://github.com/uTasker/uTasker-Kinetis

file system/parameter system and flash API document:
https://www.utasker.com/docs/uTasker/uTaskerFileSystem_3.PDF

Regards

Mark
[uTasker project developer for Kinetis and i.MX RT]

0 件の賞賛
返信