MCPWM Update MCPWM_TIMERx_PRESCALE and MCPWM_TIMERx_PERIOD

lucapassarella
Posts: 8
Joined: Mon Nov 28, 2022 11:29 am

MCPWM Update MCPWM_TIMERx_PRESCALE and MCPWM_TIMERx_PERIOD

Postby lucapassarella » Sat Feb 10, 2024 9:04 pm

Hi
I would like to know when MCPWM_TIMERx_PRESCALE is updated

The documentation describe how I can control the update of MCPWM_TIMERx_PERIOD configuring register MCPWM_TIMERx_PERIOD_UPMETHOD (I'm using TEZ rn) but not what happen to MCPWM_TIMERx_PRESCALE

I would like to know when a write to MCPWM_TIMERx_PRESCALE get applied to the actual scaler
(Immediately? TEZ? TEP? only on manual sync?)

ALSO what happen if I set MCPWM_TIMERx_PERIOD_UPMETHOD=0 (immediate) and set MCPWM_TIMERx_PERIOD to a value that is LOWER than the current MCPWM_TIMERx_VALUE?
( new MCPWM_TIMER0_PERIOD < MCPWM_TIMER0_VALUE < current MCPWM_TIMER0_PERIOD Does it immediately jump to TEZ? or having already passed the value of period it keep running until it overflow?)




Unfortunately I'm not using IDF and writing directly to registers (IDF do not enable me to do what I want)
I'm working with both ESP32 and ESP32-S3

Thanks,
Luca

ESP_morris
Posts: 290
Joined: Wed Sep 05, 2018 6:23 am

Re: MCPWM Update MCPWM_TIMERx_PRESCALE and MCPWM_TIMERx_PERIOD

Postby ESP_morris » Wed Mar 06, 2024 2:50 am

I would like to know when a write to MCPWM_TIMERx_PRESCALE get applied to the actual scaler
New timer pre-scale value will take effect when the timer goes from STOP to START.
new MCPWM_TIMER0_PERIOD < MCPWM_TIMER0_VALUE < current MCPWM_TIMER0_PERIOD Does it immediately jump to TEZ? or having already passed the value of period it keep running until it overflow?
it keep running until it overflow. No TEP event would be generated.

lucapassarella
Posts: 8
Joined: Mon Nov 28, 2022 11:29 am

Re: MCPWM Update MCPWM_TIMERx_PRESCALE and MCPWM_TIMERx_PERIOD

Postby lucapassarella » Tue Mar 12, 2024 3:55 pm

New timer pre-scale value will take effect when the timer goes from STOP to START.
So there is no way to have it updated on TEZ?

So in this case it get updated:
  1. PWM_TIMERx_CFG1_REG.PWM_TIMERx_START = [0, 1, 3, 4]
  2. Timer stop at Zero or Period (or was already stopped)
  3. PWM_TIMERx_CFG1_REG.PWM_TIMERx_START = [2, 3, 4]
Also does going back and forth from freeze and increase mode in PWM_TIMERx_CFG1_REG.PWM_TIMER0_MOD counts as a start/stop?


Thanks,
Luca

Who is online

Users browsing this forum: No registered users and 137 guests