Issue with MCPWM Prescaler on ESP32-S3
Posted: Sun Sep 08, 2024 8:41 pm
Hello everyone,
I’ve been working with the MCPWM feature on the ESP32-S3 and encountered an issue with updating the prescaler values on the fly, similar to what was discussed in the original post (viewtopic.php?t=14210). In that post, henrik.basic presented a workaround that worked for the ESP32.
Following the same workaround:
This worked well on my ESP32 board, when I tried using the exact same code on the ESP32-S3, the prescaler value didn’t update as expected. I still encountered the issue where the prescaler was stuck at the old value.
I’ve tried experimenting with different delays between stopping and restarting the timer, but I haven’t been able to resolve this on the ESP32-S3. It seems like the ESP32-S3 might handle the prescaler differently, or there could be other factors in play with this newer chip.
Has anyone else experienced this issue with the ESP32-S3? If so, were you able to find a working solution? I’d appreciate any insights or recommendations!
Thank you in advance for your help.
I’ve been working with the MCPWM feature on the ESP32-S3 and encountered an issue with updating the prescaler values on the fly, similar to what was discussed in the original post (viewtopic.php?t=14210). In that post, henrik.basic presented a workaround that worked for the ESP32.
Following the same workaround:
Code: Select all
mcpwm0.timer[0].mode.start = 0; // Stop on TEZ
mcpwm0.timer[0].period.prescale = newPrescale;
mcpwm0.timer[0].sync.timer_phase = 0;
mcpwm0.timer[0].sync.sync_sw ^= 1;
delayMicroseconds(0);
mcpwm0.timer[0].mode.start = 2; // Free running
I’ve tried experimenting with different delays between stopping and restarting the timer, but I haven’t been able to resolve this on the ESP32-S3. It seems like the ESP32-S3 might handle the prescaler differently, or there could be other factors in play with this newer chip.
Has anyone else experienced this issue with the ESP32-S3? If so, were you able to find a working solution? I’d appreciate any insights or recommendations!
Thank you in advance for your help.