Skip to content

About

eMIOS Onboard LED Example using RTD Drivers on FRDM-A-S32K344

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

NXP Application Code Hub

Control LED Brightness Through the eMIOS PWM Function on FRDM-A-S32K344 Using MCAL Drivers

This demo showcases how to configure the Enhanced Modular I/O Subsystem (eMIOS) module to operate in PWM mode, specifically in OPWMB (Output Pulse Width Modulation Buffered) mode, using the RTD high-level drivers, commonly known as MCAL drivers.

OPWMB generates a simple output PWM signal, which is used to change the brightness of the red LED (100% DC, intermediate, and then 0% DC). This cycle repeats 10 times.

Boards: FRDM-A-S32K344

Categories: Motor Control

Peripherals: eMIOS, PWM

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

2.1 Required Hardware

2.2 Debugger Connection

  • Connect the Type-C USB cable to PC and FRDM-A-S32K356 board for power supply and debugging

3. Setup

3.1 Import the Project into 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-control-led-emios-pwm-s32k344-mcal

  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 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 manage the program flow.

4. Results

The RED LED demonstrates a smooth breathing effect with gradual brightness transitions, repeating the sequence 10 times:

  • Fade IN: The LED gradually increases in brightness from 0% to 100% duty cycle in smooth increments
  • Hold at Maximum: The LED remains at full brightness (100% DC) for a brief period
  • Fade OUT: The LED gradually decreases in brightness from 100% to 0% duty cycle in smooth increments
  • Hold at Minimum: The LED remains off (0% DC) for a brief period

The dimming effect is achieved by:

  • Using eMIOS channel 1_CH_12 in OPWMB (Output Pulse Width Modulation Buffered) mode
  • Setting the counter bus period to 0x9000 on eMIOS channel 1_CH_23
  • Incrementally adjusting the duty cycle in steps of 0x100 (256 decimal)
  • Adding delays of 50,000 iterations between each duty cycle change for smooth visual transitions
  • Adding longer delays (10,000,000 iterations) at maximum and minimum brightness states

After completing 10 breathing cycles, the PWM driver is de-initialized and the program enters an idle state.

An example check file is included that is used to automatically test examples. It writes a pass or fail status to memory at a specific address.

5. Support

Project Metadata

Board badge

Category 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 the difference 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 June 11th 2025
1.1 Updated to FRDM Automotive S32K3 + S32M27 (RTD 7.0.1) August 25th 2026

About

eMIOS Onboard LED Example using RTD Drivers on FRDM-A-S32K344

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages