Read/Write flash in FRDM KW41Z

cancel
Showing results for 
Search instead for 
Did you mean: 

Read/Write flash in FRDM KW41Z

Jump to solution
741 Views
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

Labels (3)
0 Kudos
1 Solution
446 Views
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 

View solution in original post

4 Replies
446 Views
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 Kudos
446 Views
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 Kudos
447 Views
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 

448 Views
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 Kudos