Read/Write flash in FRDM KW41Z

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Read/Write flash in FRDM KW41Z

跳至解决方案
1,154 次查看
kunalkotecha1
Senior Contributor II

Hi All,

I am using BLE + thread hybrid application for FRDM KW41Z board. I want to store some details into permanent storage and read them on every reboot. I explored into the SDK but I didn't find any example code demonstrating some read/write operations in permanent storage.

Can anyone help me on how to read and write data in flash? Also, Are there any filesystem API available like fopen, fwrite, etc. ?

FRDM version:

a) BLE HOST v1.2.6
b) IEEE 802.15.4 MAC v5.3.6
c) NXP Thread v1.1.1.20
d) CONNECTIVITY FRAMEWORK v5.3.6

e) Thread SDK: SDK_2.2.0_FRDM-KW41Z_LINUX

Regards,

Kunal

标签 (3)
0 项奖励
1 解答
859 次查看
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

P-Flash is program flash, which is where you store program code.

D-Flash is data flash, where you store non-volatile data.

I was able to run the example correctly from my side, you might want to check the App_NvmWrite function and to understand more about this topic, please check the BLE Application Developer's Guide putting special attention to the chapter 2.3 Non-Volatile Memory (NVM) access, I believe that might work for your purposes especially as there are already APIs and usage in the connectivity framework. 

Regards, 

Estephania 

在原帖中查看解决方案

4 回复数
859 次查看
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

By any chance, have you checked the pflash example in the SDK ? Wasn't it helpful for you? If that was not what you were looking for, just let me know. 

Regards, 
Estephania 

0 项奖励
859 次查看
kunalkotecha1
Senior Contributor II

Hi estephania_martinez ,

I flashed the default "pflash" example but its not even able to boot. I read the "MCUXpresso SDK API Reference Manual_MKW41Z4.pdf" which says flash driver api's are meant for C90TFS. I added the below lines from pdf.

"The flash provides the C90TFS Flash driver of MCUXpresso SDK devices with the C90TFS Flash module inside. The flash driver provides general APIs to handle specific operations on C90TFS/FTFx Flash
module."

Can you please help me with storing some data in flash and reading them back?Also, What is pflash, dflash and are there are documents explaining them? At what address should I store the data?

Below are the flash properties read from my hybrid application.

kFLASH_PropertyPflashSectorSize: 0x800
kFLASH_PropertyPflashTotalSize: 0x80000
kFLASH_PropertyPflashBlockSize: 0x40000
kFLASH_PropertyPflashBlockCount: 0x2
kFLASH_PropertyPflashBlockBaseAddr: 0x0
kFLASH_PropertyPflashFacSupport: 0x1
kFLASH_PropertyPflashAccessSegmentSize: 0x2000
kFLASH_PropertyPflashAccessSegmentCount: 0x40
kFLASH_PropertyFlexRamBlockBaseAddr: 0x0
kFLASH_PropertyFlexRamTotalSize: 0x0
kFLASH_PropertyDflashSectorSize: 0x0
kFLASH_PropertyDflashTotalSize: 0x0
kFLASH_PropertyDflashBlockSize: 0x0
kFLASH_PropertyDflashBlockCount: 0x0
kFLASH_PropertyDflashBlockBaseAddr: 0x0
kFLASH_PropertyEepromTotalSize: 0x0
kFLASH_PropertyFlashMemoryIndex: 0x0
kFLASH_PropertyFlashCacheControllerIndex: 0x0

Regards,

Kunal

0 项奖励
860 次查看
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

P-Flash is program flash, which is where you store program code.

D-Flash is data flash, where you store non-volatile data.

I was able to run the example correctly from my side, you might want to check the App_NvmWrite function and to understand more about this topic, please check the BLE Application Developer's Guide putting special attention to the chapter 2.3 Non-Volatile Memory (NVM) access, I believe that might work for your purposes especially as there are already APIs and usage in the connectivity framework. 

Regards, 

Estephania 

861 次查看
kunalkotecha1
Senior Contributor II

Hello,

Thank you for your suggestions. I have tried with NVM API and able to do read/write operations.

Thanks,

Kunal

0 项奖励