Skip to content

About

Multirate Scheduler S32K358

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

NXP Application Code Hub

Multi-Rate Automotive Scheduler Using eMIOS SAOC and GPT

This example implements a multi-rate cooperative scheduler on the S32K358 (Cortex-M7) using the RTD AUTOSAR 4.9 drivers on a shared eMIOS_1 counter bus. A GPT channel generates a 1 ms tick that releases 10 ms, 100 ms and 1000 ms tasks, while an eMIOS SAOC (OCU) compare event provides hardware-assisted deadline supervision for the 10 ms task; the 100 ms and 1000 ms tasks are supervised in software. A demo load-injection mode (auto-toggled every 5 s) forces deadline overruns, and a status report is sent over UART every second. The on-board RGB LED shows the state: GREEN = normal, BLUE = load injection, RED = missed deadline.

Boards: FRDM-A-S32K358

Categories: Tools

Peripherals: eMIOS, SIUL2, COUNTER

Toolchains: S32 Design Studio IDE

Table of Contents

  1. Software and Tools
  2. Hardware
  3. Setup
  4. Results
  5. Support
  6. Release Notes

1. Software and Tools

This example was developed using the FRDM Automotive Bundle for S32K3 + S32M27. To download and install the complete software and tools ecosystem, use the following link:

2. Hardware

3. Setup

3.1 Import the project to S32 Design Studio IDE

  1. Open S32 Design Studio IDE. In the Dashboard Panel, choose Import project from Application Code Hub.

  2. Find the demo by searching: dm-persistent-settings-s32k358

  3. Open the project, click the GitHub link, S32 Design Studio IDE will automatically retrieve project attributes, then click Next>.

  4. Select main branch and then click Next>.

  5. Select your local path for the repo in the Destination->Directory: window. The S32 Design Studio IDE will clone the repo into this path, click Next>.

  6. Select Import existing Eclipse projects then click Next>.

  7. Select the project in this repo (only one project in this repo) then click Finish.

3.2 Generating, Building and Running the Example

  1. In Project Explorer, right-click the project and select Update Code and Build Project. This will generate the configuration (Pins, Clocks, Peripherals), update the source code and build the project using the active configuration (e.g. Debug_FLASH). Make sure the build completes successfully and the *.elf file is generated without errors.

    Press Yes in the SDK Component Management pop-up window to continue.

  2. Go to Debug and select Debug Configurations. There will be a debug configuration for this project:

     Configuration Name                  Description
     -------------------------------     -----------------------
     $(example)_debug_flash_pemicro      Debug the FLASH configuration using PEmicro probe
    

    Select the desired debug configuration and click on Debug. Now the perspective will change to the Debug Perspective. Use the controls to control the program flow.

4. Results

Once the application is flashed and running, open a serial terminal on the board's console UART to observe the scheduler in action. After the welcoming banner is shown a status report is transmitted every second summarizing the scheduler activity.
During normal operation all tasks complete well within their deadlines and no misses are recorded:

Scheduler Report
----------------
10ms Executions  : 100
100ms Executions : 10
1000ms Executions: 1
Missed Deadlines : 0 (0)
CPU Load Mode    : OFF

Every 5 seconds the demo automatically toggles into load injection mode, artificially stressing the 10 ms task until it overruns its deadline. The hardware-assisted eMIOS SAOC compare event detects the overrun and the missed-deadline counter starts incrementing:

Scheduler Report
----------------
10ms Executions  : 200
100ms Executions : 20
1000ms Executions: 2
Missed Deadlines : 8 (8)
CPU Load Mode    : ON

The first number in the Missed Deadlines field is the count of new misses since the previous report, while the number in parentheses is the running total since startup.

The on-board RGB LEDs give an at-a-glance visual indication of the current state:

LED Color Meaning
USERLED0 GREEN Normal mode - all tasks meeting deadlines
USERLED0 BLUE Load injection mode active
USERLED1 RED GPT Timer ticks

This demonstrates a multi-rate cooperative scheduler releasing tasks at 10 ms, 100 ms and 1000 ms rates from a single shared time base, with the fastest (and most timing-critical) task under hardware-assisted deadline supervision, while the slower tasks rely on software period checks. The automatic mode toggling makes it easy to observe both the nominal behavior and the deadline-miss detection without requiring any user interaction.

5. Support

For general technical questions related to NXP microcontrollers, please use the NXP Community Forum.

Project Metadata

Board badge

Category badge

Peripheral badge Peripheral badge Peripheral badge

Toolchain badge

Questions regarding the content/correctness of this example can be entered as Issues within this GitHub repository.

Note: For more general technical questions regarding NXP Microcontrollers and differences in expected functionality, enter your questions on the NXP Community Forum

Follow us on Youtube Follow us on LinkedIn Follow us on Facebook Follow us on Twitter

6. Release Notes

Version Description / Update Date
1.0 Initial release on Application Code Hub October 1st, 2026

About

Multirate Scheduler S32K358

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages