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.
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:
- Personal Computer
- USB Type-C cable
- FRDM-A-S32K344

- Connect the Type-C USB cable to PC and FRDM-A-S32K356 board for power supply and debugging
-
Open S32 Design Studio IDE, in the Dashboard Panel, choose Import project from Application Code Hub.
-
Find the demo by searching: dm-control-led-emios-pwm-s32k344-mcal
-
Open the project, click the GitHub link, S32 Design Studio IDE will automatically retrieve project attributes, then click Next>.
-
Select main branch and then click Next>.
-
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>.
-
Select Import existing Eclipse projects then click Next>.
-
Select the project in this repo (only one project in this repo) then click Finish.
-
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. -
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 probeSelect 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.
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.
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
| 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 |





