Page 1 of 1

MCPWM Update MCPWM_TIMERx_PRESCALE and MCPWM_TIMERx_PERIOD

Posted: Sat Feb 10, 2024 9:04 pm
by lucapassarella
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

Re: MCPWM Update MCPWM_TIMERx_PRESCALE and MCPWM_TIMERx_PERIOD

Posted: Wed Mar 06, 2024 2:50 am
by ESP_morris
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.

Re: MCPWM Update MCPWM_TIMERx_PRESCALE and MCPWM_TIMERx_PERIOD

Posted: Tue Mar 12, 2024 3:55 pm
by lucapassarella
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