FEE write/reads, single byte only?

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

FEE write/reads, single byte only?

1,584 Views
pb632146
Contributor V

I have code that used to be run on Arduino that runs EEPROM.put/get with uint16 and uint32.

I assume with the FEE MCAL drivers that I need to split these into 2/4 uint8 byte chunks to pass through to the FEE_Write and if I just give it a uint16 array it will not work, but I wanted to ask to make sure.

Similarly for Read that if I gave it a pointer to a uint16 array that it will not give me the full 16 bits and that I need to have an uint8 array of double the length that I then realign into a single value.

0 Kudos
Reply
10 Replies

1,579 Views
pb632146
Contributor V
Additionally if I am writing just one byte do I need to be putting that in an array and passing it to FEE_Write? Pass it a pointer to the singular uint8?

The pointers are starting to confuse me.
0 Kudos
Reply

1,556 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @pb632146 

You are supposed to configure your Fee Blocks in the configurator like this:

lukaszadrapa_0-1737120178679.png

One Fee Block is a record which you will update when calling Fee_Write function.

The size can be set from 1 - 65535 bytes:

lukaszadrapa_1-1737120253446.png

The maximum 65535 is theoretical value only, it's limited by sector size. But Fee is usually used for small blocks of data, so it doesn't matter. You can use any size.

And you are simply passing pointer to uint8. It doesn't matter what kind of arrays or data structure you have, you just need to pass the pointer.

lukaszadrapa_2-1737120395177.png

 In case of Fee_Read, you are also just passing uint8 pointer. In addition, you are allowed to read only part of the record - this is specified by offset and length:

lukaszadrapa_3-1737120527301.png

Regards,

Lukas

 

0 Kudos
Reply

1,543 Views
pb632146
Contributor V

Thank you, so regardless of I pass it a uint8 variable or an array(like in fee_example_s32k344) it will properly write the correct amount of bytes

1. Also is there an easier way to generate large amounts of Fee Blocks? I am looking to store up to 100 sensor info with 50 calibration points of 23 bytes and while I can make the blocks 23 bytes for the calibration points it would be nice to avoid having to manually add 5000 fee config blocks, as well as be able to adjust the ratio of sensors and calibration points more easily. Something like giving it an XML sheet?

2. In the worst case I could make each sensor be a block 1000 bytes large  as I do not need to calibrate often, but how do I actually assign Memsector batches properly?

To do so I would like to make one large sector batch of about 120kb. The memsector batches are made in 8kb physical sectors so I would need to connect multiple. Is it just increasing the "Mem number of sectors" to however many continuous sectors I need and increasing the erase size to 120k? Or do I add multiple batches of sequential physical sectors?

 

pb632146_1-1737167894220.png

 

3. Also I have been trying to convert the FEE_Example_S32K344 to run on my 342, but it just hard faults during FEE_init(). 

pb632146_2-1737168055191.pngpb632146_3-1737168074747.png

Any help on what to do to fix this would be greatly appreciated.

 

 

0 Kudos
Reply

1,472 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

1. The only option I can see is to edit the *.mex file. You need to add structures like this:

lukaszadrapa_0-1737461639741.png

 2. I already shared this screenshot here on this community to understand how the flash sector assignment works. See attached Fee_config.png.

You are not allowed to create continuous segment and you are not allowed to use too large data blocks. The limitation is given by sector size. Take a look at this thread:

https://community.nxp.com/t5/S32K/s32k312-FEE/m-p/1965182

3. It's caused by read-while-write error, most likely. Try to enable this option, so the code modifying the flash is running from RAM memory:

lukaszadrapa_2-1737461938848.png

 

Regards,

Lukas

 

 

0 Kudos
Reply

1,400 Views
pb632146
Contributor V

I have attatched the files for S32k342 and the example for 344_EVB, neither of which get past init

0 Kudos
Reply

1,439 Views
pb632146
Contributor V

I did find this post of yours about the MemAcc config variant and even after checking both mine and the provided example both are on Variant-Pre-Compile and neither initialize properly https://community.nxp.com/t5/S32K/s32k312-FEE/m-p/1965649/highlight/true#M41530

and the mem load access option is not available to me

 

pb632146_1-1737498849943.png

 

 

 

0 Kudos
Reply

1,450 Views
pb632146
Contributor V

I have followup to 2 and 3

For 2, I understand that each sector has a 8192 byte size and how to assign cluster to memacc, but there is also a setting labeled "number of sectors"  which in RTD_MEM_43_INFLS_UM.pdf is stated to be "number of contiguous sectors with identical values," would this not be for creating a MemSectorBatch larger than a single sector? If not, what does Mem Number Of Sectors actually do?

pb632146_2-1737475285322.png

 

pb632146_0-1737475024624.png

pb632146_1-1737475060461.png

pb632146_5-1737475899658.png

 

 

For 3 the issue appears to be that the example code from FEE_Example_S32K344 initializes both FEE and MemAcc with NullPtrs which means it never initializes. I have found MemAcc_BOARD_InitPeripherals_Config for memacc in MemAcc_BOARD_InitPeripherals_PBcfg.h but I cannot find the Fee_ConfigType define for Fee_Init in Fee_Cfg.h or Fee_features.h, where would it be found? I cannot find it in the example code either

pb632146_3-1737475543330.pngpb632146_4-1737475549360.png

 

0 Kudos
Reply

1,442 Views
pb632146
Contributor V

pb632146_0-1737498492430.png

 

0 Kudos
Reply

1,443 Views
pb632146
Contributor V
Also the error appeared to be caused by MemSectorBatch_1 not being large enough, but the program still does not get past initialization as Fee_GetStatus only returns MEMIF_UNINIT
0 Kudos
Reply

1,482 Views
pb632146
Contributor V
The issue appears to be that the example code from FEE_Example_S32K344 initializes both FEE and MemAcc with NullPtrs which means it never initializes. I have found MemAcc_BOARD_InitPeripherals_Config for memacc in MemAcc_BOARD_InitPeripherals_PBcfg.h but I cannot find the Fee_ConfigType define for Fee_Init in Fee_Cfg.h or Fee_features.h, where would it be found? I cannot find it in the example code either
0 Kudos
Reply