Flash EEE Read and Write

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

Flash EEE Read and Write

Jump to solution
3,002 Views
ruihang_wu
Contributor III

I'm using the EEERead and EEEWrite block to store data to nonvolatile memory. Reading from the address is not a problem. However I'm seeing only the last 8 bit being written. I have 3 uint16 variables, They are stored using the flash EEEWrite block with offset 0x0000, 0x0002, 0x0004. Using FreeMaster I only see the last 8 bit of 0x14000000, 0x14000002, and 0x14000004 change, but the first 8 bit always remains 11111111, effectively losing the first 8 bits when I am reading from those addresses again.

I have tried setting the type to uint32 but it's still only the last 8 bits that gets saved.

 

I have attached the freemaster and simulink files as reference.

1 Solution
2,827 Views
paulvlase
NXP Employee
NXP Employee

Hi @ruihang_wu , @Maciek , @oeren5 

 

The problem is that we didn't multiple the size of the input data buffer by the size of the selected data type.

 

Can you try the following fix:

1. Unzip the attached flash_s32k_eeewrite.zip file.

1. Copy flash_s32k_eeewrite.tlc file to <TBX_ROOT>\src\mbdtbx_s32k\blocks\flash folder, where <TBX_ROOT> is the output of mbd_find_s32k_root().

2. Build and run your model.

 

Regards,

Paul

View solution in original post

6 Replies
2,828 Views
paulvlase
NXP Employee
NXP Employee

Hi @ruihang_wu , @Maciek , @oeren5 

 

The problem is that we didn't multiple the size of the input data buffer by the size of the selected data type.

 

Can you try the following fix:

1. Unzip the attached flash_s32k_eeewrite.zip file.

1. Copy flash_s32k_eeewrite.tlc file to <TBX_ROOT>\src\mbdtbx_s32k\blocks\flash folder, where <TBX_ROOT> is the output of mbd_find_s32k_root().

2. Build and run your model.

 

Regards,

Paul

2,817 Views
ruihang_wu
Contributor III

It works with all the data types I tested if I create a new model. But if I change change one of the existing models I get an unspecified error.

ruihang_wu_1-1604524037782.png

I tried deleting the generated mbd_rtw folder and I get the same message.

Wondering if @Maciek and @oeren5 are seeing the same thing

0 Kudos
2,879 Views
ruihang_wu
Contributor III

I worked around the problem for now by slicing the variable to uint8 and saving that. And concatenating the two halves when reading.

The variable was changed to int16 for unrelated reasons.

Screenshot 2020-10-28 092940.png

Screenshot 2020-10-28 093342.png

Another work around would be to follow this example

https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/How-to-use-your-own-C-code-in-our-Toolbox-...

and apply the C code from this example

https://community.nxp.com/t5/S32-Design-Studio-Knowledge-Base/EXAMPLE-S32K144-EEEPROM-usage-No-SDK/t...

The matlab S function blocks will handle the read and write in this case.

 

I guess these are the two ways to go about it until the block is updated.

2,913 Views
mariuslucianand
NXP Employee
NXP Employee

@paulvlase , Can you comment on this?

Marius

0 Kudos
2,957 Views
Maciek
Contributor V

I can confirm similar behavior. Using Memory monitor in S32K Design Studio, on custom board with S32K116, we have seen that writing uint32 value results in writing correctly only the lowest significant byte.

But reading and writing uint8 values works fine.

0 Kudos
2,975 Views
oeren5
Contributor III

Hi everyone,

This is Ozan and I experienced similar problem with Flash EEE read and write blocks. S32K144EVB, mbdt v4.2 and Simulink 2020a is used. 

I try to store 14 different data in non-volatile memory and then read the data and I could not succeed it. Normally I will use a vector with 14 elements and I use a selector to select the indented element. But for now I used 14 constant in order to test the ability. I basically write 14 constants (in type uint32) to non volatile memory with offset values 0x000, 0x0010, 0x0020...... 0x0130. Then I used Flash EEERead block to read this values and write them in to volatile memory. I used Freemaster to read the values from both volatile memory blocks (write_valx) and non-volatile address but both show different values than the ones that I used. How can I solve this problem and store multiple different data?

The screenshots of model are provided below.

Thanks in advance.

oeren5_0-1603374248832.pngoeren5_1-1603374275718.pngoeren5_2-1603374302337.pngoeren5_3-1603375327325.pngoeren5_4-1603375345369.png