Hello,
We are developing a MBDT project for a motor control application.
We are using Matlab/Simulink to flash directly an EVB S32K344 but the generated code is also integrated in a bigger project with a classic development using S32DS.
Everything works great on the EVB S32K344, but we want to migrate to our final custom board which is based on a S32K322.
I tried to change the processor in the Simulink HW configuration and importing the .mex file from the S32K344, but it doesn’t work.
What is the best way to change the processor while keeping the current configuration from the 344 (most of the pins used are the same) ?
Best regards,
Jérémy
Hello @robertv .
Thank you for the patch. It seems to improve the compilation because I have no more error concerning Freemaster. Unfortunately, we change the micro for S32K344 because we couldn't configure properly the K322 with the motor control needs. We still can't figure out what is the real problem. We will continue on the K322 in a second time.
Best regards,
Jeremy
We have made some progresses. The SW team have started a new S32K322 empty S32DS project and merge the S32K344 configuration file .mex generated by MBDT. It seems to compile.
I have changed the processor in MBDT and try to change the Configuration Project Template by selecting their new configuration file. But the code does not compile.
When I start a new MBDT project with a S32K322 with only GPIO blocs, it works. But when I add a Freemaster configuration blocs, it does not compile with the following error:
### Starting build procedure for: S32K322_Test ### Generating code and artifacts to 'Model specific' folder structure ### Generating code into build folder: C:\Users\xxxxxx\OneDrive - xxxxxx x\Documents\MATLAB\Copy_of_NXP_MBDT2_GD3000\S32K322_Test\S32K322_Test_ert_rtw ### Invoking Target Language Compiler on S32K322_Test.rtw ### Using System Target File: C:\Program Files\MATLAB\R2024b\rtw\c\ert\ert.tlc ### Loading TLC function libraries ....... ### Generating TLC interface API for custom data . ### Initial pass through model to cache user defined code Failure in TbxParams.getRTDHeader(line 0) : Hardware type (S32K322-Q172) not supported. ### Build procedure for S32K322_Test aborted due to an error.
Build Summary
0 of 1 models built (1 models already up to date) Build duration: 0h 0m 24.826s
Error: File: C:\Users\xxxxxx\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\NXP_MBDToolbox_S32K3\mbdtbx_s32k3\+mbd_s32k3\+common\blocks\fm\fm_config.tlc Line: 24 Column: 19 Unable to find connection_type within the scope
Component:Simulink | Category:Block diagram error
When I change the processor to S32K312, it works.
I think the problem comes from the Freemaster driver which does include the S32K322 natively. But NXP told me it was possible to communicate with the S32K322 with Freemaster.
Do you have the steps to do, to compile a MBDT S32K322 project with Freemaster communication?
Hello @JeremyC ,
The Model-Based Design Toolbox does not provide a tried and tested implementation for using FreeMASTER on the S32K322. This means that by default, it will be considered an unsupported hardware part for FreeMASTER functionality.
The S32K322 configuration we provide inside the toolbox corresponds to the Q172 package, so please let us know if you are using another variation or if you are using an older version of the Model Based Design Toolbox (the latest version being 1.6).
In an attempt to provide some form of FreeMASTER support, we tried enabling the default functionality for FreeMASTER on the S32K322 in terms of our general toolbox framework (i.e enabling the access to this functionality). However, please note that this was not tested and validated on the hardware. You could try this fix which will hopefully solve the current error you are encountering. In terms of hardware testing, you could try it on your setup as well, but we cannot guarantee its behavior since it is not tested and validated on our side.
Please create a backup of the files '\mbdtbx_s32k3\src\mbdt_lpuart.h' and '\mbdtbx_s32k3\+mbd_s32k3\+nxp\ThxParams.p' and replace them with the ones I attached.
These changes correspond to a configuration where the 4 UART instances are using the clocks LPUART0_CLK, LPUART1_CLK, LPUART2_CLK AND LPUART3_CLK, as well as 4 interrupts LPUART0_IRQn, LPUART1_IRQn, LPUART2_IRQn and LPUART3_IRQn. If you only have one UART instance configured, it will use the LPUART0_CLK and LPUART0_IRQn.
Please let me know if this works on your hardware. Your input would be incredibly powerful in helping us improve the toolbox.
Regards,
Robert V