Hello,
I am working on non-volatile memory (NVM) for S32K344 as we don't have any dedicated eeprom on it, I am using its flash memory to store my data, I have created a data write and read block by using mask. Now when I am using it is giving me unexpected errors like
1.) if I enter data randomly on freeMaster(software) then it doesn't retain it, and when I am entering the data in sequence then it is retaining it.
2.) and sometimes when I enter the data maybe for parameter 1 then it gives the data to parameter 1 and 2 both, when this shouldn't happen.
3.) When I create parameters 10 onwards, they are also not retaining the data.
I don't where I am going wrong about this.
I have attached the Matlab, Simulink and the freeMaster file for reference.
Hello @rishabh_10!
Thank you for your interest in Model-Based Design Toolbox for S32K3!
I downloaded the attached archive and I had a look on the Simulink model and on the generated code.
After the initial analysis, I have the following comments:
The way Mem_43_INFLS Driver is designed, the operation specific function calls(Read, Write, Erase, BlankCheck, HwSpecificService etc.) only check if the parameters given to them are correct and in range and they only prepare the driver for the data exchange. The actual data transfer and/or flash memory manipulation are performed during the MainFunction call only. For an operation to be successfully completed, several MainFunction calls may be required, depending on the size of the data to be read/written/compared/erased and on the Mem Read/Write Page Size, which is configurable from the Mem_43_INFLS Driver form S32CT or from EB Tresos. (e.g: if the Write function receives a buffer of 40 uint8 values and Mem Write Page Size is 8, the MainFunction will be triggered 5 times before completing the write job). Ideally, any job request should be immediately followed by MainFunction calls until the driver becomes idle. Now, there are 2 faulty scenarios possible(and , from what I observed, both are present in this given example):
On this specific example, where the 3 issues are presented, I can provide the following conclusions:
My suggestion for this model would be to ensure each NVMWrite / Nvm Read subsystem has its own dedicated "MainFunction Trigger Subsystem" to prevent conflicts and overwriting of job parameters.
I hope these explanations will be of help to you and others. Please let me know if the issues are still persistent or if I can assist you in other ways.
Best regards,
Florin.