Libraries for hybrid synchronized ISR-based multi-PWM-channels

These libraries designed to provide hybrid synchronized multi-PWM-channels with these features and limitations

Features

  • Multiple PWM channels
  • Output PWM to almost any digital pins
  • Synchronized (when PWM => HIGH) between PWM channels with frequencies are integer multiples. For example, 10Hz, 20Hz, 100Hz, etc.
  • Optional callback functions for start/stop of duty-cycles.
  • Independent frequency / duty-cycle

Limitations

  • Frequency is limited, depending on the MCU speed, due to not fully hardware-controlled PWM.
  • Currently, max frequency is limited at 500Hz. Tested OK at 1000Hz for ESP32, but limiting at 500Hz to be safe.

New PWM Libraries with these features


Sample Terminal output

1. ISR_16_PWMs_Array_Complex on ESP8266_NODEMCU_ESP12E

Starting ISR_16_PWMs_Array_Complex on ESP8266_NODEMCU_ESP12E
ESP8266_PWM v1.0.0
CPU Frequency = 160 MHz
[PWM] ESP8266TimerInterrupt: _fre = 312500.00 , _count = 6
Starting ITimer OK, micros() = 2068917
Channel : 0	Period : 1000000		OnTime : 50000	Start_Time : 2072412
Channel : 1	Period : 500000		OnTime : 50000	Start_Time : 2072412
Channel : 2	Period : 333333		OnTime : 66666	Start_Time : 2072412
Channel : 3	Period : 250000		OnTime : 75000	Start_Time : 2072412
Channel : 4	Period : 200000		OnTime : 80000	Start_Time : 2072412
Channel : 5	Period : 166666		OnTime : 74999	Start_Time : 2072412
Channel : 6	Period : 142857		OnTime : 71428	Start_Time : 2072412
Channel : 7	Period : 125000		OnTime : 68750	Start_Time : 2072412
SimpleTimer (ms): 2000, ms : 12118352, Dms : 10045971
PWM Channel : 0, programmed Period (us): 1000000, actual : 1000013, programmed DutyCycle : 5, actual : 5.00
PWM Channel : 1, programmed Period (us): 500000, actual : 500008, programmed DutyCycle : 10, actual : 10.00
PWM Channel : 2, programmed Period (us): 333333, actual : 333350, programmed DutyCycle : 20, actual : 20.00
PWM Channel : 3, programmed Period (us): 250000, actual : 250003, programmed DutyCycle : 30, actual : 30.00
PWM Channel : 4, programmed Period (us): 200000, actual : 200006, programmed DutyCycle : 40, actual : 39.99
PWM Channel : 5, programmed Period (us): 166666, actual : 166676, programmed DutyCycle : 45, actual : 44.99
PWM Channel : 6, programmed Period (us): 142857, actual : 142867, programmed DutyCycle : 50, actual : 49.99
PWM Channel : 7, programmed Period (us): 125000, actual : 125011, programmed DutyCycle : 55, actual : 54.98
SimpleTimer (ms): 2000, ms : 22187724, Dms : 10069372
PWM Channel : 0, programmed Period (us): 1000000, actual : 1000013, programmed DutyCycle : 5, actual : 5.00
PWM Channel : 1, programmed Period (us): 500000, actual : 500008, programmed DutyCycle : 10, actual : 10.00
PWM Channel : 2, programmed Period (us): 333333, actual : 333350, programmed DutyCycle : 20, actual : 20.00
PWM Channel : 3, programmed Period (us): 250000, actual : 250003, programmed DutyCycle : 30, actual : 30.00
PWM Channel : 4, programmed Period (us): 200000, actual : 200006, programmed DutyCycle : 40, actual : 39.99
PWM Channel : 5, programmed Period (us): 166666, actual : 166676, programmed DutyCycle : 45, actual : 44.99
PWM Channel : 6, programmed Period (us): 142857, actual : 142868, programmed DutyCycle : 50, actual : 49.99
PWM Channel : 7, programmed Period (us): 125000, actual : 125012, programmed DutyCycle : 55, actual : 54.98
SimpleTimer (ms): 2000, ms : 32257074, Dms : 10069350
PWM Channel : 0, programmed Period (us): 1000000, actual : 1000013, programmed DutyCycle : 5, actual : 5.00
PWM Channel : 1, programmed Period (us): 500000, actual : 500008, programmed DutyCycle : 10, actual : 10.00
PWM Channel : 2, programmed Period (us): 333333, actual : 333350, programmed DutyCycle : 20, actual : 20.00
PWM Channel : 3, programmed Period (us): 250000, actual : 250003, programmed DutyCycle : 30, actual : 30.00
PWM Channel : 4, programmed Period (us): 200000, actual : 200007, programmed DutyCycle : 40, actual : 39.99
PWM Channel : 5, programmed Period (us): 166666, actual : 166674, programmed DutyCycle : 45, actual : 44.99
PWM Channel : 6, programmed Period (us): 142857, actual : 142868, programmed DutyCycle : 50, actual : 49.99
PWM Channel : 7, programmed Period (us): 125000, actual : 125012, programmed DutyCycle : 55, actual : 54.98

2. ISR_16_PWMs_Array_Complex on PORTENTA_H7_M7

Starting ISR_16_PWMs_Array_Complex on PORTENTA_H7_M7
PORTENTA_H7_SLOW_PWM v1.0.0
[PWM] Portenta_H7_TimerInterrupt: Timer Input Freq (Hz) = 200000000
[PWM] Frequency = 1000000.00 , _count = 20
Starting ITimer OK, micros() = 3391815
Channel : 0	Period : 1000000		OnTime : 50000	Start_Time : 3392013
Channel : 1	Period : 500000		OnTime : 50000	Start_Time : 3392013
Channel : 2	Period : 333333		OnTime : 66666	Start_Time : 3392013
Channel : 3	Period : 250000		OnTime : 75000	Start_Time : 3392013
Channel : 4	Period : 200000		OnTime : 80000	Start_Time : 3392013
Channel : 5	Period : 166667		OnTime : 75000	Start_Time : 3392013
Channel : 6	Period : 142857		OnTime : 71428	Start_Time : 3392013
Channel : 7	Period : 125000		OnTime : 68750	Start_Time : 3392013
Channel : 8	Period : 111111		OnTime : 66666	Start_Time : 3392013
Channel : 9	Period : 100000		OnTime : 65000	Start_Time : 3392013
Channel : 10	Period : 66667		OnTime : 46666	Start_Time : 3392013
Channel : 11	Period : 50000		OnTime : 37500	Start_Time : 3392013
Channel : 12	Period : 40000		OnTime : 32000	Start_Time : 3392013
Channel : 13	Period : 33333		OnTime : 28333	Start_Time : 3392013
Channel : 14	Period : 25000		OnTime : 22500	Start_Time : 3392013
Channel : 15	Period : 20000		OnTime : 19000	Start_Time : 3392013
SimpleTimer (ms): 2000, us : 13335232, Dus : 9943221
PWM Channel : 0, programmed Period (us): 1000000, actual : 1000000, programmed DutyCycle : 5, actual : 5.00
PWM Channel : 1, programmed Period (us): 500000, actual : 500000, programmed DutyCycle : 10, actual : 10.00
PWM Channel : 2, programmed Period (us): 333333, actual : 333340, programmed DutyCycle : 20, actual : 20.00
PWM Channel : 3, programmed Period (us): 250000, actual : 250000, programmed DutyCycle : 30, actual : 30.00
PWM Channel : 4, programmed Period (us): 200000, actual : 200000, programmed DutyCycle : 40, actual : 39.99
PWM Channel : 5, programmed Period (us): 166667, actual : 166680, programmed DutyCycle : 45, actual : 44.99
PWM Channel : 6, programmed Period (us): 142857, actual : 142860, programmed DutyCycle : 50, actual : 49.99
PWM Channel : 7, programmed Period (us): 125000, actual : 124998, programmed DutyCycle : 55, actual : 55.00
PWM Channel : 8, programmed Period (us): 111111, actual : 111120, programmed DutyCycle : 60, actual : 59.99
PWM Channel : 9, programmed Period (us): 100000, actual : 100000, programmed DutyCycle : 65, actual : 65.00
PWM Channel : 10, programmed Period (us): 66667, actual : 66680, programmed DutyCycle : 70, actual : 69.98
PWM Channel : 11, programmed Period (us): 50000, actual : 50001, programmed DutyCycle : 75, actual : 75.00
PWM Channel : 12, programmed Period (us): 40000, actual : 40001, programmed DutyCycle : 80, actual : 80.00
PWM Channel : 13, programmed Period (us): 33333, actual : 33341, programmed DutyCycle : 85, actual : 84.94
PWM Channel : 14, programmed Period (us): 25000, actual : 25000, programmed DutyCycle : 90, actual : 89.91
PWM Channel : 15, programmed Period (us): 20000, actual : 20000, programmed DutyCycle : 95, actual : 95.00
SimpleTimer (ms): 2000, us : 23279451, Dus : 9944219
PWM Channel : 0, programmed Period (us): 1000000, actual : 1000000, programmed DutyCycle : 5, actual : 5.00
PWM Channel : 1, programmed Period (us): 500000, actual : 499999, programmed DutyCycle : 10, actual : 10.00
PWM Channel : 2, programmed Period (us): 333333, actual : 333340, programmed DutyCycle : 20, actual : 20.00
PWM Channel : 3, programmed Period (us): 250000, actual : 250000, programmed DutyCycle : 30, actual : 30.00
PWM Channel : 4, programmed Period (us): 200000, actual : 200000, programmed DutyCycle : 40, actual : 40.00
PWM Channel : 5, programmed Period (us): 166667, actual : 166680, programmed DutyCycle : 45, actual : 45.00
PWM Channel : 6, programmed Period (us): 142857, actual : 142860, programmed DutyCycle : 50, actual : 49.99
PWM Channel : 7, programmed Period (us): 125000, actual : 125000, programmed DutyCycle : 55, actual : 54.99
PWM Channel : 8, programmed Period (us): 111111, actual : 111135, programmed DutyCycle : 60, actual : 59.98
PWM Channel : 9, programmed Period (us): 100000, actual : 100000, programmed DutyCycle : 65, actual : 65.00
PWM Channel : 10, programmed Period (us): 66667, actual : 66680, programmed DutyCycle : 70, actual : 69.98
PWM Channel : 11, programmed Period (us): 50000, actual : 50000, programmed DutyCycle : 75, actual : 74.96
PWM Channel : 12, programmed Period (us): 40000, actual : 40000, programmed DutyCycle : 80, actual : 80.00
PWM Channel : 13, programmed Period (us): 33333, actual : 33340, programmed DutyCycle : 85, actual : 84.94
PWM Channel : 14, programmed Period (us): 25000, actual : 25000, programmed DutyCycle : 90, actual : 90.00
PWM Channel : 15, programmed Period (us): 20000, actual : 20000, programmed DutyCycle : 95, actual : 95.00

3. ISR_16_PWMs_Array_Complex on Nano 33 BLE

Starting ISR_16_PWMs_Array_Complex on Nano 33 BLE
NRF52_MBED_Slow_PWM v1.0.0
[PWM] NRF52_MBED_TimerInterrupt: Timer = NRF_TIMER3
[PWM] Frequency = 16000000.00 , _count = 160
Starting ITimer OK, micros() = 2703801
Channel : 0	Period : 1000000		OnTime : 50000	Start_Time : 2705662
Channel : 1	Period : 500000		OnTime : 50000	Start_Time : 2705662
Channel : 2	Period : 333333		OnTime : 66666	Start_Time : 2705662
Channel : 3	Period : 250000		OnTime : 75000	Start_Time : 2705662
Channel : 4	Period : 200000		OnTime : 80000	Start_Time : 2705662
Channel : 5	Period : 166666		OnTime : 74999	Start_Time : 2705662
Channel : 6	Period : 142857		OnTime : 71428	Start_Time : 2705662
Channel : 7	Period : 125000		OnTime : 68750	Start_Time : 2705662
Channel : 8	Period : 111111		OnTime : 66666	Start_Time : 2705662
Channel : 9	Period : 100000		OnTime : 65000	Start_Time : 2705662
Channel : 10	Period : 66666		OnTime : 46666	Start_Time : 2705662
Channel : 11	Period : 50000		OnTime : 37500	Start_Time : 2705662
Channel : 12	Period : 40000		OnTime : 32000	Start_Time : 2705662
Channel : 13	Period : 33333		OnTime : 28333	Start_Time : 2705662
Channel : 14	Period : 25000		OnTime : 22500	Start_Time : 2705662
Channel : 15	Period : 20000		OnTime : 19000	Start_Time : 2705662
SimpleTimer (ms): 2000, us : 12763937, Dus : 10058301
PWM Channel : 0, programmed Period (us): 1000000, actual : 1000022, programmed DutyCycle : 5, actual : 5.00
PWM Channel : 1, programmed Period (us): 500000, actual : 500001, programmed DutyCycle : 10, actual : 9.99
PWM Channel : 2, programmed Period (us): 333333, actual : 333336, programmed DutyCycle : 20, actual : 19.99
PWM Channel : 3, programmed Period (us): 250000, actual : 250029, programmed DutyCycle : 30, actual : 29.99
PWM Channel : 4, programmed Period (us): 200000, actual : 200010, programmed DutyCycle : 40, actual : 39.99
PWM Channel : 5, programmed Period (us): 166666, actual : 166695, programmed DutyCycle : 45, actual : 44.98
PWM Channel : 6, programmed Period (us): 142857, actual : 142881, programmed DutyCycle : 50, actual : 49.98
PWM Channel : 7, programmed Period (us): 125000, actual : 125023, programmed DutyCycle : 55, actual : 54.98
PWM Channel : 8, programmed Period (us): 111111, actual : 111141, programmed DutyCycle : 60, actual : 59.97
PWM Channel : 9, programmed Period (us): 100000, actual : 100005, programmed DutyCycle : 65, actual : 64.96
PWM Channel : 10, programmed Period (us): 66666, actual : 66662, programmed DutyCycle : 70, actual : 69.98
PWM Channel : 11, programmed Period (us): 50000, actual : 50015, programmed DutyCycle : 75, actual : 74.98
PWM Channel : 12, programmed Period (us): 40000, actual : 39997, programmed DutyCycle : 80, actual : 79.98
PWM Channel : 13, programmed Period (us): 33333, actual : 33360, programmed DutyCycle : 85, actual : 84.90
PWM Channel : 14, programmed Period (us): 25000, actual : 25027, programmed DutyCycle : 90, actual : 89.85
PWM Channel : 15, programmed Period (us): 20000, actual : 19996, programmed DutyCycle : 95, actual : 94.83
SimpleTimer (ms): 2000, us : 22840437, Dus : 10076500
PWM Channel : 0, programmed Period (us): 1000000, actual : 1000015, programmed DutyCycle : 5, actual : 5.00
PWM Channel : 1, programmed Period (us): 500000, actual : 500014, programmed DutyCycle : 10, actual : 10.00
PWM Channel : 2, programmed Period (us): 333333, actual : 333367, programmed DutyCycle : 20, actual : 20.00
PWM Channel : 3, programmed Period (us): 250000, actual : 250032, programmed DutyCycle : 30, actual : 29.99
PWM Channel : 4, programmed Period (us): 200000, actual : 200035, programmed DutyCycle : 40, actual : 39.99
PWM Channel : 5, programmed Period (us): 166666, actual : 166702, programmed DutyCycle : 45, actual : 44.98
PWM Channel : 6, programmed Period (us): 142857, actual : 142865, programmed DutyCycle : 50, actual : 49.99
PWM Channel : 7, programmed Period (us): 125000, actual : 125015, programmed DutyCycle : 55, actual : 54.99
PWM Channel : 8, programmed Period (us): 111111, actual : 111141, programmed DutyCycle : 60, actual : 59.98
PWM Channel : 9, programmed Period (us): 100000, actual : 100018, programmed DutyCycle : 65, actual : 64.98
PWM Channel : 10, programmed Period (us): 66666, actual : 66695, programmed DutyCycle : 70, actual : 69.95
PWM Channel : 11, programmed Period (us): 50000, actual : 49997, programmed DutyCycle : 75, actual : 75.03
PWM Channel : 12, programmed Period (us): 40000, actual : 40000, programmed DutyCycle : 80, actual : 79.95
PWM Channel : 13, programmed Period (us): 33333, actual : 33329, programmed DutyCycle : 85, actual : 84.86
PWM Channel : 14, programmed Period (us): 25000, actual : 25040, programmed DutyCycle : 90, actual : 89.85
PWM Channel : 15, programmed Period (us): 20000, actual : 20015, programmed DutyCycle : 95, actual : 94.91

4. ISR_8_PWMs_Array_Complex on megaAVR Nano Every

Starting ISR_8_PWMs_Array_Complex on megaAVR Nano Every
megaAVR_SLOW_PWM v1.0.0
CPU Frequency = 16 MHz
TCB Clock Frequency = 16MHz for highest accuracy
[PWM] TCB 1
[PWM] ==================
[PWM] Init, Timer = 1
[PWM] CTRLB   = 0
[PWM] CCMP    = 65535
[PWM] INTCTRL = 0
[PWM] CTRLA   = 1
[PWM] ==================
[PWM] Frequency = 30000.00 , CLK_TCB_FREQ = 16000000
[PWM] setFrequency: _CCMPValueRemaining =  533
[PWM] ==================
[PWM] set_CCMP, Timer = 1
[PWM] CTRLB   = 0
[PWM] CCMP    = 533
[PWM] INTCTRL = 1
[PWM] CTRLA   = 1
Starting  ITimer1 OK, micros() = 2013088
Channel : 0	Period : 1000000		OnTime : 50000	Start_Time : 2014076
Channel : 1	Period : 500000		OnTime : 50000	Start_Time : 2014076
Channel : 2	Period : 333333		OnTime : 66666	Start_Time : 2014076
Channel : 3	Period : 250000		OnTime : 62500	Start_Time : 2014076
Channel : 4	Period : 200000		OnTime : 60000	Start_Time : 2014076
Channel : 5	Period : 166666		OnTime : 58333	Start_Time : 2014076
Channel : 6	Period : 142857		OnTime : 57142	Start_Time : 2014076
Channel : 7	Period : 125000		OnTime : 56250	Start_Time : 2014076
SimpleTimer (us): 2000, us : 12060576, Dus : 10046608
PWM Channel : 0, prog Period (ms): 1000.00, actual : 1000048, prog DutyCycle : 5, actual : 5.00
PWM Channel : 1, prog Period (ms): 500.00, actual : 500120, prog DutyCycle : 10, actual : 9.99
PWM Channel : 2, prog Period (ms): 333.33, actual : 333344, prog DutyCycle : 20, actual : 19.99
PWM Channel : 3, prog Period (ms): 250.00, actual : 250004, prog DutyCycle : 25, actual : 24.97
PWM Channel : 4, prog Period (ms): 200.00, actual : 200012, prog DutyCycle : 30, actual : 29.99
PWM Channel : 5, prog Period (ms): 166.67, actual : 166668, prog DutyCycle : 35, actual : 34.97
PWM Channel : 6, prog Period (ms): 142.86, actual : 142868, prog DutyCycle : 40, actual : 40.02
PWM Channel : 7, prog Period (ms): 125.00, actual : 125048, prog DutyCycle : 45, actual : 44.92
SimpleTimer (us): 2000, us : 22128588, Dus : 10068012
PWM Channel : 0, prog Period (ms): 1000.00, actual : 1000012, prog DutyCycle : 5, actual : 4.99
PWM Channel : 1, prog Period (ms): 500.00, actual : 500092, prog DutyCycle : 10, actual : 9.99
PWM Channel : 2, prog Period (ms): 333.33, actual : 333380, prog DutyCycle : 20, actual : 19.98
PWM Channel : 3, prog Period (ms): 250.00, actual : 249976, prog DutyCycle : 25, actual : 25.00
PWM Channel : 4, prog Period (ms): 200.00, actual : 200008, prog DutyCycle : 30, actual : 29.96
PWM Channel : 5, prog Period (ms): 166.67, actual : 166664, prog DutyCycle : 35, actual : 34.95
PWM Channel : 6, prog Period (ms): 142.86, actual : 143024, prog DutyCycle : 40, actual : 39.93
PWM Channel : 7, prog Period (ms): 125.00, actual : 125068, prog DutyCycle : 45, actual : 44.96
SimpleTimer (us): 2000, us : 32200044, Dus : 10071456
PWM Channel : 0, prog Period (ms): 1000.00, actual : 1000048, prog DutyCycle : 5, actual : 4.99
PWM Channel : 1, prog Period (ms): 500.00, actual : 500088, prog DutyCycle : 10, actual : 9.99
PWM Channel : 2, prog Period (ms): 333.33, actual : 333344, prog DutyCycle : 20, actual : 20.01
PWM Channel : 3, prog Period (ms): 250.00, actual : 249976, prog DutyCycle : 25, actual : 24.99
PWM Channel : 4, prog Period (ms): 200.00, actual : 200056, prog DutyCycle : 30, actual : 29.95
PWM Channel : 5, prog Period (ms): 166.67, actual : 166748, prog DutyCycle : 35, actual : 34.97
PWM Channel : 6, prog Period (ms): 142.86, actual : 142992, prog DutyCycle : 40, actual : 39.91
PWM Channel : 7, prog Period (ms): 125.00, actual : 125136, prog DutyCycle : 45, actual : 44.91

5. ISR_8_PWMs_Array_Complex on Teensy 4.1

Starting ISR_8_PWMs_Array_Complex on Teensy 4.1
Teensy_Slow_PWM v1.0.0
CPU Frequency = 600 MHz
[PWM] TEENSY_TIMER_1: , F_BUS_ACTUAL (MHz) = 150
[PWM] Request interval = 20 , actual interval (us) = 20
[PWM] Prescale = 0 , _timerCount = 1500
Starting  ITimer OK, micros() = 2968006
Channel : 0	Period : 1000000		OnTime : 50000	Start_Time : 2968007
Channel : 1	Period : 500000		OnTime : 50000	Start_Time : 2968007
Channel : 2	Period : 333333		OnTime : 66666	Start_Time : 2968007
Channel : 3	Period : 250000		OnTime : 62500	Start_Time : 2968007
Channel : 4	Period : 200000		OnTime : 60000	Start_Time : 2968007
Channel : 5	Period : 166666		OnTime : 58333	Start_Time : 2968007
Channel : 6	Period : 142857		OnTime : 57142	Start_Time : 2968007
Channel : 7	Period : 125000		OnTime : 56250	Start_Time : 2968007
SimpleTimer (us): 2000, us : 12968028, Dus : 10000021
PWM Channel : 0, prog Period (ms): 1000.00, actual : 1000014, prog DutyCycle : 5, actual : 5.00
PWM Channel : 1, prog Period (ms): 500.00, actual : 500006, prog DutyCycle : 10, actual : 10.00
PWM Channel : 2, prog Period (ms): 333.33, actual : 333351, prog DutyCycle : 20, actual : 20.00
PWM Channel : 3, prog Period (ms): 250.00, actual : 250003, prog DutyCycle : 25, actual : 25.00
PWM Channel : 4, prog Period (ms): 200.00, actual : 200006, prog DutyCycle : 30, actual : 30.00
PWM Channel : 5, prog Period (ms): 166.67, actual : 166676, prog DutyCycle : 35, actual : 34.99
PWM Channel : 6, prog Period (ms): 142.86, actual : 142868, prog DutyCycle : 40, actual : 39.99
PWM Channel : 7, prog Period (ms): 125.00, actual : 125002, prog DutyCycle : 45, actual : 44.99
SimpleTimer (us): 2000, us : 22968058, Dus : 10000030
PWM Channel : 0, prog Period (ms): 1000.00, actual : 1000013, prog DutyCycle : 5, actual : 5.00
PWM Channel : 1, prog Period (ms): 500.00, actual : 500006, prog DutyCycle : 10, actual : 10.00
PWM Channel : 2, prog Period (ms): 333.33, actual : 333351, prog DutyCycle : 20, actual : 20.00
PWM Channel : 3, prog Period (ms): 250.00, actual : 250003, prog DutyCycle : 25, actual : 24.99
PWM Channel : 4, prog Period (ms): 200.00, actual : 200007, prog DutyCycle : 30, actual : 30.00
PWM Channel : 5, prog Period (ms): 166.67, actual : 166675, prog DutyCycle : 35, actual : 34.99
PWM Channel : 6, prog Period (ms): 142.86, actual : 142867, prog DutyCycle : 40, actual : 39.99
PWM Channel : 7, prog Period (ms): 125.00, actual : 125002, prog DutyCycle : 45, actual : 44.99
SimpleTimer (us): 2000, us : 32968087, Dus : 10000029
PWM Channel : 0, prog Period (ms): 1000.00, actual : 1000013, prog DutyCycle : 5, actual : 5.00
PWM Channel : 1, prog Period (ms): 500.00, actual : 500007, prog DutyCycle : 10, actual : 10.00
PWM Channel : 2, prog Period (ms): 333.33, actual : 333351, prog DutyCycle : 20, actual : 20.00
PWM Channel : 3, prog Period (ms): 250.00, actual : 250003, prog DutyCycle : 25, actual : 24.99
PWM Channel : 4, prog Period (ms): 200.00, actual : 200007, prog DutyCycle : 30, actual : 30.00
PWM Channel : 5, prog Period (ms): 166.67, actual : 166676, prog DutyCycle : 35, actual : 34.99
PWM Channel : 6, prog Period (ms): 142.86, actual : 142868, prog DutyCycle : 40, actual : 39.99
PWM Channel : 7, prog Period (ms): 125.00, actual : 125001, prog DutyCycle : 45, actual : 44.99

6. ISR_8_PWMs_Array_Complex on SAM_DUE

Starting ISR_8_PWMs_Array_Complex on SAM_DUE
SAMDUE_Slow_PWM v1.0.0
CPU Frequency = 84 MHz
Timer Frequency = 84 MHz
[PWM] Using Timer( 0 ) = TC0
[PWM] Channel = 0 , IRQ = TC0_IRQn
ITimer attached to Timer(0)
Channel : 0	Period : 1000000		OnTime : 50000	Start_Time : 2009501
Channel : 1	Period : 500000		OnTime : 50000	Start_Time : 2009501
Channel : 2	Period : 333333		OnTime : 66666	Start_Time : 2009501
Channel : 3	Period : 200000		OnTime : 50000	Start_Time : 2009501
Channel : 4	Period : 100000		OnTime : 30000	Start_Time : 2009501
Channel : 5	Period : 50000		OnTime : 17500	Start_Time : 2009501
Channel : 6	Period : 33333		OnTime : 13333	Start_Time : 2009501
Channel : 7	Period : 20000		OnTime : 9000	Start_Time : 2009501
SimpleTimer (us): 2000, us : 12054051, Dus : 10044561
PWM Channel : 0, prog Period (us): 1000000.00, actual : 1000000, prog DutyCycle : 5, actual : 5.00
PWM Channel : 1, prog Period (us): 500000.00, actual : 500005, prog DutyCycle : 10, actual : 10.00
PWM Channel : 2, prog Period (us): 333333.34, actual : 333340, prog DutyCycle : 20, actual : 20.00
PWM Channel : 3, prog Period (us): 200000.00, actual : 200009, prog DutyCycle : 25, actual : 25.00
PWM Channel : 4, prog Period (us): 100000.00, actual : 100012, prog DutyCycle : 30, actual : 29.98
PWM Channel : 5, prog Period (us): 50000.00, actual : 49996, prog DutyCycle : 35, actual : 34.98
PWM Channel : 6, prog Period (us): 33333.33, actual : 33340, prog DutyCycle : 40, actual : 39.98
PWM Channel : 7, prog Period (us): 20000.00, actual : 20000, prog DutyCycle : 45, actual : 45.00
SimpleTimer (us): 2000, us : 22116061, Dus : 10062010
PWM Channel : 0, prog Period (us): 1000000.00, actual : 1000000, prog DutyCycle : 5, actual : 5.00
PWM Channel : 1, prog Period (us): 500000.00, actual : 500005, prog DutyCycle : 10, actual : 10.00
PWM Channel : 2, prog Period (us): 333333.34, actual : 333340, prog DutyCycle : 20, actual : 20.00
PWM Channel : 3, prog Period (us): 200000.00, actual : 200009, prog DutyCycle : 25, actual : 25.00
PWM Channel : 4, prog Period (us): 100000.00, actual : 99988, prog DutyCycle : 30, actual : 30.00
PWM Channel : 5, prog Period (us): 50000.00, actual : 49992, prog DutyCycle : 35, actual : 34.99
PWM Channel : 6, prog Period (us): 33333.33, actual : 33340, prog DutyCycle : 40, actual : 39.98
PWM Channel : 7, prog Period (us): 20000.00, actual : 20000, prog DutyCycle : 45, actual : 45.00

6. ISR_8_PWMs_Array_Complex on NUCLEO_H743ZI2

Starting ISR_16_PWMs_Array_Complex on NUCLEO_H743ZI2
STM32_SLOW_PWM v1.0.0
[PWM] STM32TimerInterrupt: Timer Input Freq (Hz) = 240000000
[PWM] Frequency = 1000000.00 , _count = 20
Starting ITimer OK, micros() = 2015843
Channel : 0	Period : 1000000		OnTime : 50000	Start_Time : 2019319
Channel : 1	Period : 500000		OnTime : 50000	Start_Time : 2019319
Channel : 2	Period : 333333		OnTime : 66666	Start_Time : 2019319
Channel : 3	Period : 250000		OnTime : 75000	Start_Time : 2019319
Channel : 4	Period : 200000		OnTime : 80000	Start_Time : 2019319
Channel : 5	Period : 166666		OnTime : 74999	Start_Time : 2019319
Channel : 6	Period : 142857		OnTime : 71428	Start_Time : 2019319
Channel : 7	Period : 125000		OnTime : 68750	Start_Time : 2019319
Channel : 8	Period : 111111		OnTime : 66666	Start_Time : 2019319
Channel : 9	Period : 100000		OnTime : 65000	Start_Time : 2019319
Channel : 10	Period : 66666		OnTime : 46666	Start_Time : 2019319
Channel : 11	Period : 50000		OnTime : 37500	Start_Time : 2019319
Channel : 12	Period : 40000		OnTime : 32000	Start_Time : 2019319
Channel : 13	Period : 33333		OnTime : 28333	Start_Time : 2019319
Channel : 14	Period : 25000		OnTime : 22500	Start_Time : 2019319
Channel : 15	Period : 20000		OnTime : 19000	Start_Time : 2019319
SimpleTimer (ms): 2000, us : 12111000, Dus : 10091682
PWM Channel : 0, programmed Period (us): 1000000, actual : 1000000, programmed DutyCycle : 5, actual : 5.00
PWM Channel : 1, programmed Period (us): 500000, actual : 500000, programmed DutyCycle : 10, actual : 10.00
PWM Channel : 2, programmed Period (us): 333333, actual : 333340, programmed DutyCycle : 20, actual : 20.00
PWM Channel : 3, programmed Period (us): 250000, actual : 250000, programmed DutyCycle : 30, actual : 30.00
PWM Channel : 4, programmed Period (us): 200000, actual : 200020, programmed DutyCycle : 40, actual : 40.00
PWM Channel : 5, programmed Period (us): 166666, actual : 166680, programmed DutyCycle : 45, actual : 45.00
PWM Channel : 6, programmed Period (us): 142857, actual : 142860, programmed DutyCycle : 50, actual : 49.99
PWM Channel : 7, programmed Period (us): 125000, actual : 125020, programmed DutyCycle : 55, actual : 54.98
PWM Channel : 8, programmed Period (us): 111111, actual : 111120, programmed DutyCycle : 60, actual : 59.99
PWM Channel : 9, programmed Period (us): 100000, actual : 100020, programmed DutyCycle : 65, actual : 64.99
PWM Channel : 10, programmed Period (us): 66666, actual : 66680, programmed DutyCycle : 70, actual : 69.98
PWM Channel : 11, programmed Period (us): 50000, actual : 50000, programmed DutyCycle : 75, actual : 75.00
PWM Channel : 12, programmed Period (us): 40000, actual : 40000, programmed DutyCycle : 80, actual : 80.00
PWM Channel : 13, programmed Period (us): 33333, actual : 33340, programmed DutyCycle : 85, actual : 84.94
PWM Channel : 14, programmed Period (us): 25000, actual : 25000, programmed DutyCycle : 90, actual : 90.00
PWM Channel : 15, programmed Period (us): 20000, actual : 20000, programmed DutyCycle : 95, actual : 95.00
SimpleTimer (ms): 2000, us : 22266000, Dus : 10155000
PWM Channel : 0, programmed Period (us): 1000000, actual : 1000000, programmed DutyCycle : 5, actual : 5.00
PWM Channel : 1, programmed Period (us): 500000, actual : 500000, programmed DutyCycle : 10, actual : 10.00
PWM Channel : 2, programmed Period (us): 333333, actual : 333340, programmed DutyCycle : 20, actual : 20.00
PWM Channel : 3, programmed Period (us): 250000, actual : 250020, programmed DutyCycle : 30, actual : 30.00
PWM Channel : 4, programmed Period (us): 200000, actual : 200020, programmed DutyCycle : 40, actual : 40.00
PWM Channel : 5, programmed Period (us): 166666, actual : 166680, programmed DutyCycle : 45, actual : 44.98
PWM Channel : 6, programmed Period (us): 142857, actual : 142860, programmed DutyCycle : 50, actual : 49.99
PWM Channel : 7, programmed Period (us): 125000, actual : 125000, programmed DutyCycle : 55, actual : 54.99
PWM Channel : 8, programmed Period (us): 111111, actual : 111120, programmed DutyCycle : 60, actual : 59.99
PWM Channel : 9, programmed Period (us): 100000, actual : 100000, programmed DutyCycle : 65, actual : 65.00
PWM Channel : 10, programmed Period (us): 66666, actual : 66680, programmed DutyCycle : 70, actual : 69.98
PWM Channel : 11, programmed Period (us): 50000, actual : 50000, programmed DutyCycle : 75, actual : 75.00
PWM Channel : 12, programmed Period (us): 40000, actual : 40000, programmed DutyCycle : 80, actual : 80.00
PWM Channel : 13, programmed Period (us): 33333, actual : 33340, programmed DutyCycle : 85, actual : 84.94
PWM Channel : 14, programmed Period (us): 25000, actual : 25020, programmed DutyCycle : 90, actual : 89.93
PWM Channel : 15, programmed Period (us): 20000, actual : 20000, programmed DutyCycle : 95, actual : 94.91

7. ISR_16_PWMs_Array_Complex on SAMD_NANO_33_IOT

Starting ISR_16_PWMs_Array_Complex on SAMD_NANO_33_IOT
SAMD_Slow_PWM v1.0.0
[PWM] _period = 20 , frequency = 50000.00
[PWM] SAMDTimerInterrupt: F_CPU (MHz) = 48 , TIMER_HZ = 48
[PWM] TC3_Timer::startTimer _Timer = 0x 42002c00 , TC3 = 0x 42002c00
[PWM] SAMD21 TC3 period = 20 , _prescaler = 1
[PWM] _compareValue = 959
Starting ITimer OK, micros() = 3682076
Channel : 0	Period : 1000000		OnTime : 50000	Start_Time : 3682450
Channel : 1	Period : 500000		OnTime : 50000	Start_Time : 3682450
Channel : 2	Period : 66666		OnTime : 13333	Start_Time : 3682450
Channel : 3	Period : 50000		OnTime : 15000	Start_Time : 3682450
Channel : 4	Period : 40000		OnTime : 16000	Start_Time : 3682450
Channel : 5	Period : 33333		OnTime : 16666	Start_Time : 3682450
Channel : 6	Period : 25000		OnTime : 15000	Start_Time : 3682450
Channel : 7	Period : 20000		OnTime : 14000	Start_Time : 3682450
SimpleTimer (ms): 2000, us : 13688073, Dus : 
PWM Channel : 0, programmed Period (us): 1000000, actual : 1000000, programmed DutyCycle : 5, actual : 5.00
PWM Channel : 1, programmed Period (us): 500000, actual : 500005, programmed DutyCycle : 10, actual : 10.00
PWM Channel : 2, programmed Period (us): 66666, actual : 66680, programmed DutyCycle : 20, actual : 19.98
PWM Channel : 3, programmed Period (us): 50000, actual : 50000, programmed DutyCycle : 30, actual : 30.00
PWM Channel : 4, programmed Period (us): 40000, actual : 40000, programmed DutyCycle : 40, actual : 40.00
PWM Channel : 5, programmed Period (us): 33333, actual : 33339, programmed DutyCycle : 50, actual : 49.97
PWM Channel : 6, programmed Period (us): 25000, actual : 24994, programmed DutyCycle : 60, actual : 60.01
PWM Channel : 7, programmed Period (us): 20000, actual : 20000, programmed DutyCycle : 70, actual : 69.98
SimpleTimer (ms): 2000, us : 23860692, Dus : 10172619
PWM Channel : 0, programmed Period (us): 1000000, actual : 1000000, programmed DutyCycle : 5, actual : 5.00
PWM Channel : 1, programmed Period (us): 500000, actual : 500000, programmed DutyCycle : 10, actual : 10.00
PWM Channel : 2, programmed Period (us): 66666, actual : 66680, programmed DutyCycle : 20, actual : 19.98
PWM Channel : 3, programmed Period (us): 50000, actual : 50000, programmed DutyCycle : 30, actual : 30.00
PWM Channel : 4, programmed Period (us): 40000, actual : 40000, programmed DutyCycle : 40, actual : 40.00
PWM Channel : 5, programmed Period (us): 33333, actual : 33339, programmed DutyCycle : 50, actual : 49.97
PWM Channel : 6, programmed Period (us): 25000, actual : 24994, programmed DutyCycle : 60, actual : 60.02
PWM Channel : 7, programmed Period (us): 20000, actual : 20000, programmed DutyCycle : 70, actual : 70.00
2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.