JN5189 flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

JN5189 flash

1,161 Views
Viki
Contributor II

Hi All,

The chip I use is JN5189, the SDK version I use is SDK2.6.2_JN5189DK6, and the routines I use are zigbee_ed_rx_on and zigbee_coordinator.

Now I need to write the user data into Flash. My save/read method is to refer to the flash_demo routines provided in the SDK. For example, use FLASH_Init(), FLASH_ErasePages(),FLASH_Program() and nv_safereadfromFlash () to read and write to Flash.
After testing, call FLASH_ErasePages() to erase flash and then read flash, read out all the values are 0.Call FLASH_Program() to write data to flash and then read flash, and the value that is read is the same as the value that was written.It is worth mentioning that pu32Start has a value of 0x10000 (the same as in flash_demo).


Now I have the following questions:
1. Why do I call FLASH_ErasePages() to erase the flash and then read the corresponding flash, but read out the value of 0 instead of 1?


2. As the protocol stack itself has related operations with Flash, such as using PPDM_eSaveRecordData() to save data, using PDM_eReadDataFromRecord()to read data.But I don't know which page of Flash PDM_eSaveRecordData() operates on, so will I accidentally tamper with the data saved with PDM_eSaveRecordData() when I use FLASH_Program() to write data to the starting address of 0x10000?


3. Is it recommended to use the flash API in flash_demo to read and write the flash in the protocol stack?If not, what is the recommended way?

BR,

Viki

0 Kudos
5 Replies

1,155 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi @Viki,

Now I have the following questions:
1. Why do I call FLASH_ErasePages() to erase the flash and then read the corresponding flash, but read out the value of 0 instead of 1?

How are you reading the 1? Are you using these APIs in the Zigbee example?

I recommend using the PDM API which handles the storage of stack context data and application data in Non-Volatile Memory (NVM). For more information, please look at the JN518x & K32W041/K32W061 Core utility User Guide 2. Persistent Data Manager (PDM).

JN5189DK6\docs\wireless\Zigbee

Regards,

Mario

0 Kudos

1,150 Views
Viki
Contributor II

Hi @mario_castaneda ,

I used the command  DK6Programmer.exe -s COM17 -e FLASH -p jn5189dk6_zigbee_coordinator_bm.bin  to download the program and found that the value of Flash was 0 for the first read.So, I want to know if the default value is 0x00 or 0xFF before Flash writes (in the initial state).

Thank you for your reply.

BR,

Viki

0 Kudos

1,135 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Viki,

In this case, when the DK6Programmer erases the FLASH memory, it writes 0xDEAD.

You can erase or read out the memory with the following commands.

DK6Programmer.exe -s COM22 --read FLASH:0x400@0

DK6Programmer.exe -s COM22 --erase FLASH:0x100@80000

DK6Programmer.exe -s COM22 --write FLASH:0x04@80000=0x1234

 

mario_castaneda_0-1611770817285.png

Regards,

Mario

0 Kudos

1,112 Views
Viki
Contributor II

Hi @mario_castaneda ,

I'm sorry for replying to you so late.
 
After many tests, I downloaded the program using the command "DK6Programmer.exe -s COM17 -e FLASH -p jn5189dk6_zigbee_coordinator_bm.bin ", the value of reading user storage area is 0x00, and the function used for reading user data storage area is:
read.png
 
Do I set the value of the user's storage area to 0x00 every time I download the program using the "DK6Programmer.exe -s COM17 -e FLASH -p jn5189dk6_zigbee_coordinator_bm.bin "instruction? Is this normal?
 
BR,
Viki
0 Kudos

1,084 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi,

Do I set the value of the user's storage area to 0x00 every time I download the program using the "DK6Programmer.exe -s COM17 -e FLASH -p jn5189dk6_zigbee_coordinator_bm.bin "instruction? Is this normal?

If you want to save some data in that direction you could specify the offset that you want.

You could try to read the data as in the example.

PDM_eReadDataFromRecord(PDM_ID_APP_END_DEVICE,
&sDeviceDesc,
sizeof(tsDeviceDesc),
&u16ByteRead);

Regards,

Mario

0 Kudos