ESP32-S3 mcpwm.h - mcpwm_sync_config_t timer_val calculation
Posted: Wed Feb 15, 2023 2:11 pm
Hi Guys,
New to the forum and ESP32-S3 on Arduino IDE - please be kind.
Question - regarding below structure defined in ESP-IDF v4.4
https://github.com/espressif/esp-idf/bl ... er/mcpwm.h
typedef struct {
mcpwm_sync_signal_t sync_sig; /*!<Set sync input signal that will cause timer to sync*/
uint32_t timer_val; /*!<Counter value to be set after sync, in 0 ~ 999, unit: 1 / 1000 * peak*/
mcpwm_timer_direction_t count_direction; /*!<Counting direction to be set after sync */
} mcpwm_sync_config_t;
Point of interest :
Counter value to be set after sync, in 0 ~ 999, unit: 1 / 1000 * peak
Is there anyone who knows how to calculate this "unit" please?
What is this "peak" and where is defined or how can be calculated?
What i need to do is to have MCPWM0 with Timer0 sync at 0 then Timer1 and Timer2 sync internally by Timer0 but phase shifted by 120 and 270 degree -> timer0 period has to be divided by 3 and Timer1 starts at 1/3 and timer2 starts at 2/3 of Timer0
I was not able to find anywhere how this 0 to 999 unit is calculated.
I used group and timer resolution functions (80MHz and 80MHz) but even with default group of 10MHz and timer 1MHz resolutions i doubt my calculations.
My practical tests with 80M group and 80M timer and frequency 66666Hz i have timer1 start at 274 and timer2 at 548 but i have some overlapping on my scope.
Thank you.
New to the forum and ESP32-S3 on Arduino IDE - please be kind.
Question - regarding below structure defined in ESP-IDF v4.4
https://github.com/espressif/esp-idf/bl ... er/mcpwm.h
typedef struct {
mcpwm_sync_signal_t sync_sig; /*!<Set sync input signal that will cause timer to sync*/
uint32_t timer_val; /*!<Counter value to be set after sync, in 0 ~ 999, unit: 1 / 1000 * peak*/
mcpwm_timer_direction_t count_direction; /*!<Counting direction to be set after sync */
} mcpwm_sync_config_t;
Point of interest :
Counter value to be set after sync, in 0 ~ 999, unit: 1 / 1000 * peak
Is there anyone who knows how to calculate this "unit" please?
What is this "peak" and where is defined or how can be calculated?
What i need to do is to have MCPWM0 with Timer0 sync at 0 then Timer1 and Timer2 sync internally by Timer0 but phase shifted by 120 and 270 degree -> timer0 period has to be divided by 3 and Timer1 starts at 1/3 and timer2 starts at 2/3 of Timer0
I was not able to find anywhere how this 0 to 999 unit is calculated.
I used group and timer resolution functions (80MHz and 80MHz) but even with default group of 10MHz and timer 1MHz resolutions i doubt my calculations.
My practical tests with 80M group and 80M timer and frequency 66666Hz i have timer1 start at 274 and timer2 at 548 but i have some overlapping on my scope.
Thank you.