This example demonstrates the timer's functionality in PWM Generation mode and input capture mode. In this Example one Timer is configured in PWM_GEN mode and the other one is configured in INPUT_CAPTURE mode. The first timer is configured to generate a 1 KHz Square wave.
The other timer is configured to capture two consecutive edges and call the callback on second capture. In the callback the capture values are read, the difference is stored and a semaphore is posted.
Application starts the capture timer first and then starts the PWM generating timer and pends semaphore to be posted on capture. On post application stops both counters and exits.
The counter source Clock in both cases is set to MCU_HFOSC0 giving it a 25 MHz tick with counter Presacler disabled.
Parameter | Value |
---|---|
CPU + OS | r5fss0-0 nortos |
r5fss0-0 freertos | |
Toolchain | ti-arm-clang |
Boards | am243x-lp |
Example folder | examples/drivers/gp_timer/gp_timer_pwm_capture |
Shown below is a sample output when the application is run,