Hello Maciek,
The memory blocks DataMemRead and DataMemWrite, allows you on S32K access any memory memory address.
For example, the DataMemWrite Block allows you to write a Pointer Type value at the Address + Offset memory address.
This is the actual generated code
/* write to memory address */
{
<Pointer type> * address;
address = (<Pointer type> *) 0x%<Address + Offset>;
*(address) = <Input Value>;
}
However, I had a look on the S32SDK on the Flash Memory (Flash) Driver and I see that there is a driver that allows the user to write and read the memory as if dealing with an Eeprom using the flash_driver.c. If you have a short working example, I can add support to the functions you call directly from Simulink using custom code, the third method I've told you in the other thread. If not, just give me a few days to provide a working Simulink model.
Hope this helps,
Marius
Thanks for Your quick response mariuslucianandrei,
I'm looking forward for Your example model!
I didn't start writing anything yet - I was still reading documentation.
If I understand correctly, there is a way of configuring and using EEPROM without flash_driver. The configuration can be done with appropriate settings of "advanced options" of the debugger in S32DS (program partition command). Then a structure with user data fields can be put directly in FlexRAM region. But this solution seems to have some disadvantages:
- at some point we have to 'exit' Matlab/Simulink and use S32DS
- we have to adjust/change the linker file (I think the linker file used by S32K1xx MBD toolbox has no definitions of FlexRAM regions)
- we still have to write 'driver blocks' for reading/writing the user data structure in FlexRAM
If I'm wrong with the above - please let me know.
In our application, we have non-volatile data that will be re-configured very rarely - so for this writing and reading FlexNVM would be sufficient. But we also have run-time data that need to be saved frequently - for this we need EEPROM functionality. In summary working EEPROM is enough to meet the customer requirements.
If You can prepare a very simple example model with Matlab Function blocks for initial configuration of memory partition and for reading and writing EEPROM (via configured FlexRAM; all of this using flash_driver) it would help us significantly.
Thanks for help
Maciek
I'm looking to do something similar, I haven't got to get working a short example on the S32 SDK yet.
An example Simulink model would be great to get us started, I'm pretty sure this is a useful feature to have.
Thanks a lot!
Gustavo