I'm using the FEE function of an S32K311 microcontroller to store data. FEE tests for erasing and writing work fine, but on the first read attempt, without any data written, it fails to load and crashes. Similar to the C40, the first read returns 0xFF, which I can use to identify the first read/write operation and fill in the default value. Is there a way to make the first FEE return a value like 0xFF instead of crashing? I'm using RTD 4.0.0.
Hi@ LJH1
The first time you call Fee_Read(), you don’t have to write to it first. However, if the block has never been written to, the read job is likely to return MEMIF_BLOCK_INVALID or MEMIF_BLOCK_INCONSISTENT. The application layer should be able to treat it as “uninitialized” and then write the default value.
Do not rely on reading valid data directly on the first read; the correct approach is to check the job result after reading, and initialize default values and write them when invalid/inconsistent data is encountered.