How to implement watchdog for S32K344 in Simulink

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

How to implement watchdog for S32K344 in Simulink

455 Views
kodyw
Contributor II

Hello,

We configured the SWT from Config Tool from Simulink as below screenshot.

3.png

It has compile errors.  What might be wrong? or are there any examples showing how to set watchdog up for S32K344 from Simulink?

Thank you,

0 Kudos
Reply
3 Replies

388 Views
kodyw
Contributor II

Hi @dragostoma 

Thanks for your response.  We tried again by following your suggestions and use SUTOSAR Mode like the screenshot below:

kodyw_0-1724894543039.png

However, it still has compile errors.  Please see attached SWT_ErrInfo.txt.

Could you please provide some sample project that works within the Simulink?  That should help us understand what might be the issues. 

Thank you,

Kody

 

0 Kudos
Reply

374 Views
dragostoma
NXP Employee
NXP Employee

Hi,

First and foremost, I'd want to reiterate that we do not provide support in Simulink for the Watchdog peripheral in the most recent MBDT for S32K3 release (1.5.0). We will consider adding support for this peripheral to the toolbox in the future.

However, for the time being, in addition to enabling it in S32 Configuration Tools, several procedures must be completed in order to use it appropriately within Simulink (change the initialization sequence, interrupt callbacks, clock references, and so on), and using custom code due to the lack of block implementation. This is the primary reason for the compile error in your project.

At this stage, I would recommend that you start evaluating the WDG projects that have already been implemented in C code by the Real Time Drivers team. The WDG peripheral implementation and documentation are available in the RTD package that comes with the toolbox at the following location:

TOOLBOX_ROOT\S32K3_RTD\SW32K3_S32M27x_RTD_R21-11_4.0.0_P19\eclipse\plugins\Wdg_TS_T40D34M40I0R0

dragostoma_4-1724918792621.png

Wdg_Example_S32K344 may be found in the examples folder and explains how to use Watchdog peripherals in an S32K344 program.

dragostoma_5-1724918850986.png

In addition, you may locate the peripheral documentation under the doc folder.

dragostoma_6-1724918913392.png

This program can be built and debugged using NXP's S32 Design Studio, an IDE designed specifically for automotive applications. This tool is not included in the toolbox; you must manually install it. The following links provide additional information about the S32DS tool:

- S32 Design Studio IDE

- S32DS list of HOWTOs

After successfully installing S32 Design Studio and adding the necessary packages and addons to match the RTD version given in the toolbox, import the aforementioned WDG project example, by following this guide Create a new S32DS Project from Example. You should target the Wdg_Example_S32K344 project example:

dragostoma_0-1724917629226.png

dragostoma_1-1724917644291.png

After successfully importing the project example, review the description file and study the C code from the main.c file in the src folder to gain a better understanding of how the WDG peripheral operates. By accessing the Configuration.mex file, you can view the application's configuration with the WDG and all other required peripherals.

dragostoma_2-1724918114528.png

Once you've gained a better understanding of Watchdog usage, you can create and debug this application on your hardware target. To get the desired application, you can manually edit the application's code as well as the configuration. Following that, you must migrate the application to Simulink, which will require additional guidance. However, until then, I recommend that you import this example and try to create the application using S32 Design Studio.

Let us know if you encounter any difficulties.

 

Best regards,

Dragos

0 Kudos
Reply

411 Views
dragostoma
NXP Employee
NXP Employee

Hello, @kodyw,

Thank you for your interest into Model-Based Design Toolbox for S32K3.

The SWT component that you are trying to configure uses a lower level of abstraction, suggested by the _Ip in the definition of the component name.

To enable the Watchdog peripheral, you should use the MCAL abstraction layer.

dragostoma_0-1724836828920.png

After enabling the Wdg component, under the WdgSettingsConfig tab, you should be able to set up the desired configuration.

dragostoma_1-1724836828921.png

Since we provide the complete RTD driver package, you may still implement the component Wdg in our toolbox and access the Wdg's API using custom code blocks.

You can also check the following topic How to use your own C code in our Toolbox (Battery Management System example). Here you will find an additional method of using custom code inside our toolbox.

You can also check the S32DS example projects for Wdg:

dragostoma_2-1724836877694.png

dragostoma_3-1724836890355.png

Let us know if you managed to enable the Watchdog component.

 

Best regards, 

Dragos

0 Kudos
Reply