The example demonstrate the timer/letimer peripherals configuration in a way, that multiple channels are used and generate a PWM signal on certain GPIO pins.
- GSDK v4.4.3
-
One SiliconLabs Wireless Gecko Starter Kit
-
One of the SiliconLabs radio boards that listed below:
- Connect the board via a micro-USB cable to your PC to flash the example.
To test this application, you can either create a project based on an example project or start with an empty example project.
-
Make sure that this repository is added to Preferences > Simplicity Studio > External Repos.
-
From the Launcher Home, add your device to My Products, click on it, and click on the EXAMPLE PROJECTS & DEMOS tab. Find the example project filtering by multi and pwm.
-
Click the Create button on the Platform - Multi Channel PWM example. Example project creation dialog pops up -> click Finish and Project should be generated.
-
Build and flash this example to the board.
-
Create an Empty C Project project for your hardware using Simplicity Studio 5.
-
Replace the
app.c
file in the project root folder with the providedapp.c
(located in the src folder). -
Open the .slcp file. Select the SOFTWARE COMPONENTS tab and install the software components:
- [Platform] → [Peripheral] → [TIMER]
-
Build and flash the project to your device.
TIMER0 is initialized for PWM on 3 channels (0, 1, and 2) and routed to GPIO pins. PWM duty cycle on channel 0 increases from 0 -> 100%, whereas duty cycle on channel 1 decreases from 100 -> 0%. You can modify the GPIO pins configuration to the LEDs pin on the wireless starter kit or use an oscilloscope to see how PWM works on each channel.