Experimenting with various PWM modes on STM32F103C8T6.
|_ Timer_Interrupt
|_ PWM_Timer1
|_ PWM_Analog_Slope
|_ PWM_DMA
- Timer Interrupt: Using timer overflow interupt and toggling an LED with the Interrupt Service Routine.
- PWM on Timer: Using PWM generation configuration on Timer. Setting Capture Compare Register for Duty Cycle and Auto Reload Register for Frequency.
- Analog slope with PWM:
Programmatically changing the value in the Capture compare register from inside the
while(1){}
super loop with a small delay, to generate a slope in the filtered PWM signal.
- DMA controlled PWM: Feeding the values from an array containing a lookup table of different duty cycles through DMA transfer. This is advantageous because the CPU remains free throughout the transfer and the duty cycle is directly loaded from the memory to the CCR register via DMA.
[A very slow PWM with varying duty cycle]
Also checkout my other works with STM32F1: STM32F103 RTOS, STM32F103 UART and, STM32F1 GPIO Alternate Functions