NXP S32K Configuration block overwrites contents of Simulink models InitFcn callback

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

NXP S32K Configuration block overwrites contents of Simulink models InitFcn callback

Jump to solution
3,097 Views
neffnan
Contributor III

I have attached an excerpt (stripped down to the point that it's nonsensical, I realize) from my Simulink model and App Designer app. It appears to run successfully now that I've put the definition "hApp = CAN_UI;" at the beginning of the StartFcn callback (until I stop the GUI at which point it throws up warnings about missing or deleted object and starts beeping).

The instructions in the info from MathWorks at "https://www.mathworks.com/matlabcentral/answers/446302-how-do-i-update-a-gui-designed-in-app-designe...." say to put that definition into the InitFcn callback, but when I did so, the definition disappears when model simulation is run, and if I've deleted "mbd_s32k_consistency_checks(bdroot(gcs));", that reappears. It seems to me that the NXP S32K Configuration process is over-writing the contents of the InitFcn callback with its call to its consistency checks function rather than playing nice with others and appending to the contents.

How do I put a definition into the InitFcn callback and have it stay there, even with the NXP Configuration block in the model?

Thanks for whatever help you can offer.

NOTE: To exercise the attached system, run the model with the block "OnOffAnglesInput" open. The model will start the GUI. In the GUI, check the box on the left of the screen, labeled Cyl 1. Then press the On button. The numbers in the two boxes to the right are pulled from updated values in the model -- elements 3 and 4 from the 30-element vector shown in Display6 in the model. If you put in a pair of numbers in the blocks next to the check box and click ON, the numbers are updated in the model (in the block "ForEachAngleModulo720": 120 is added to the numbers entered, their new value modulo 720 is calculated, and the new values written to places 3 and 4 in Display6). The updated values go back to the GUI for display in the right-hand two boxes.  If you want to enjoy the beeping phenomenon, close the app while the model is still running and wait 1 to 2 minutes. I don't understand the time lag in the beeping -- it also continues for a while even after the model is stopped.

Regards,

Nancy

 

 

Tags (2)
0 Kudos
1 Solution
2,931 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @neffnan,

Proved out that the script is called every time during the build process so, in order to help you, I have attached a patch. 

Please replace the attached file. To do so, please type the following command in Matlab 

winopen(fullfile(mbd_find_s32k_root, 'mbdtbx_s32k', 'mscripts', 'config'))

and in the newly opened window, replace the attached p file.

This will check if the InitFcn contains or not the consistency check script call and if not, will just add it at the beginning of the function calls, leaving all your scripts there.

For now, there is no plan for an S32K1xx release so we can only help you by providing this patch.

Hope this helps,

Marius

View solution in original post

7 Replies
2,977 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @neffnan ,

I am sorry for my delayed response! Pretty busy period for us right now.

Indeed our toolbox rewrites some fields. I am thinking that the shortest way for solving your issue is to temporarily Disable the link for the S32K1 Confing block with the library, as shown below. 

Please give this a try and let me know if the callback persists.

mariuslucianand_0-1623409402829.png

Hope this helps,
Marius

0 Kudos
2,972 Views
neffnan
Contributor III

Hi Marius,

I'm afraid this didn't fix the problem. I've had to delete the S32 Configuration block altogether for the InitFcn to not get overwritten.

When do you expect an updated version of the Toolbox that doesn't overwrite contents of the callbacks but appends instead?

Thanks,

Nancy

0 Kudos
2,932 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @neffnan,

Proved out that the script is called every time during the build process so, in order to help you, I have attached a patch. 

Please replace the attached file. To do so, please type the following command in Matlab 

winopen(fullfile(mbd_find_s32k_root, 'mbdtbx_s32k', 'mscripts', 'config'))

and in the newly opened window, replace the attached p file.

This will check if the InitFcn contains or not the consistency check script call and if not, will just add it at the beginning of the function calls, leaving all your scripts there.

For now, there is no plan for an S32K1xx release so we can only help you by providing this patch.

Hope this helps,

Marius

2,907 Views
neffnan
Contributor III

Thank you Marius!  That works beautifully. I appreciate the support.

Best regards,

Nancy

3,024 Views
DarrellWhite
Contributor I

NXP Semiconductors Contents Section number Title Page Chapter 1 Preface 1.1 Overview.  38 5.3.2.1 5.3.3 Initial checks and configurations.  execute instructions, read data from the S32K System SRAM or flash memory, buffer these  S32K11x block diagram The S32K1xx has an integrated safety concept.

Official website

0 Kudos
2,989 Views
neffnan
Contributor III

yes, I'm familiar with the manual, but I don't understand your comment. What does all that have to do with the NXP MBD Toolbox overwriting the contents of a Simulink model's InitFcn callback?

0 Kudos
3,082 Views
neffnan
Contributor III

I just realized I attached the version with the definition of hApp in StartFcn, rather than in InitFcn where it's supposed to go. Here's the version that will show how "hApp = CAN_UI; disappears from InitFcn each time the model is started, and after a while the beeping will start with both the app and the model running as they are supposed to. Start the model, and the first time it will start the app for you.

 

0 Kudos