Simulink tutorial model including EEPROM functionality via Matlab Fcn block

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

Simulink tutorial model including EEPROM functionality via Matlab Fcn block

Jump to solution
2,576 Views
chrisc1
Contributor III

Hello NXP and thank you for being so helpful in these forums.

I hope that it could be possible for you to provide a Simulink model for MPC5744P-EVB or S32K144-EVB that implements EEPROM method 3) described in this previous topic https://community.nxp.com/t5/Model-Based-Design-Toolbox-MBDT/EEPROM-functionality-on-S32K1xx/m-p/987... 

using a Fcn block methodology NXP has suggested: https://uk.mathworks.com/help/simulink/ug/incorporate-c-code-using-a-matlab-function-block.html 

Having looked at the main.c file that is located at path: [...]\S32DS_Power_v2.1\S32DS\software\S32_SDK_S32PA_RTM_3.0.0\examples\MPC5744P\driver_examples\system\flash_program_erase\Sources

I think that the Simulation Target section of the Configuration Parameters would need to include references to the files that the code requires, based on the fact that the code has

#include "Cpu.h"
#include "clockMan1.h"
#include "flash_c55_driver.h"

Thus I take it that the Simulink model would need to have in its folder or path the files for ST's C55 driver unless the code can reach these outside of the Matlab folder, however I can't even find the path for clockMan1.c or clockMan1.h:

[...]\S32DS_Power_v2.1\S32DS\software\S32_SDK_S32PA_RTM_3.0.0\platform\drivers\src\flash_c55

I think it would help multiple users if for example it was possible to have a basic slx model for MPC5744P & GCC which can write one or two U16 or U32 signals into memory that remains after a power cycle. Then users can modify the code to write any additional data entries.

The code for Initialize source buffer,  Unlock all blocks in low/mid/high addresses, Erase, BlankCheck, Program, ProgramVerify, CheckSum looks like it could run well. The useful part is if NXP could provide the Simulink model to give some usable guidance on the correct implementation of the modules, as well as the recommended location to insert the code to write the user signals to memory.

 

/* MODULE main */
/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "clockMan1.h"
#include "flash_c55_driver.h"

 

Thank you very much in advance.

0 Kudos
Reply
1 Solution
2,564 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @chrisc1,

For the S32K1xx devices, we already provide blocks allowing to store data in the flash simulating an eeprom functionality. You can find an example called flash_eeeprom_s32k14x.mdl The only limitation on the S32K144 is that you have to flash the code using RAppID bootloader because there is a limitation with the OpenSDA functionality.

Now, for the MPC parts, for now, we do not provide such functionality. I have already logged an internal ticket but we are scheduled now to work on other stuff. 

Regarding your questions, we already provide a tutorial on using an external driver, in this case, the flash_c55_driver.c. You can find this toturial here https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/How-to-use-your-own-C-code-in-our-Toolbox-...

You can copy the driver sources and place them in a folder next to the .mdl and then include those files in the model so that the model will consider compiling the files as well.

Hope this helps,

Marius

 

View solution in original post

0 Kudos
Reply
2 Replies
2,565 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @chrisc1,

For the S32K1xx devices, we already provide blocks allowing to store data in the flash simulating an eeprom functionality. You can find an example called flash_eeeprom_s32k14x.mdl The only limitation on the S32K144 is that you have to flash the code using RAppID bootloader because there is a limitation with the OpenSDA functionality.

Now, for the MPC parts, for now, we do not provide such functionality. I have already logged an internal ticket but we are scheduled now to work on other stuff. 

Regarding your questions, we already provide a tutorial on using an external driver, in this case, the flash_c55_driver.c. You can find this toturial here https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/How-to-use-your-own-C-code-in-our-Toolbox-...

You can copy the driver sources and place them in a folder next to the .mdl and then include those files in the model so that the model will consider compiling the files as well.

Hope this helps,

Marius

 

0 Kudos
Reply
2,535 Views
chrisc1
Contributor III

Thank you very much Marius,

I will follow the examples. It certainly is on the 'higher' difficulty scale, so if a library block were able to carry out this specific task, I think it would be a very useful feature for several users.

Kindest regards

Chris

0 Kudos
Reply