Replies: 2 comments
-
I won't be adding MCPWM control to this library, but it seems like you might not actually need to use this hardware feature. |
Beta Was this translation helpful? Give feedback.
-
I've been working on a major update to the library (version 4.0.0) which will have some significant new capabilities using the LEDC PWM controller of the ESP32/S2/S3/C3. For the ESP32, all 16 PWM channels will be available. The new version will exploit the capabilities of the LEDC controller to add PWM synchronization. Its not perfect, but multiple PWM signals can be synchronized to within 1μs. I think this pushes the LEDC capabilities much closer to that of the MCPWM controller and it has the capacity to synchronize more signals than MCPWM. ESP32 PWM Synchronization:
Here's the logic trace of 8 PWM signals (synchronized) at 25kHz frequency and 10-bit resolution: Zooming in, the timer to timer synchronization (after phase delay calibration) was only100ns: Zooming in to max, here we can see perfect synchronization between a signal pair because they use the same timer: I should have the new release ready within the next week ... still need to update documentation. |
Beta Was this translation helpful? Give feedback.
-
If i am correct this code is (only) using the 'LEDC' PWM controller of the ESP32. I was wondering if (in the future?) it could also use the MOTOR PWM modulator of the ESP32, because i need to (accurately) control the frame speed of a (timing) camera, and for (exact) synchronisation of the camera i need more options than the freq, phase and duty cycle of an output signal of the ESP32. In fact, i need to have an interrupt generated at every timer period, and occasionally change the timer period on the spot, from this interrupt routine, or from somewhere else, with semaphores.
I managed to do this with an AT-MEGA2560 board, simply because i found the "Timer Output COMPARE" registers of that Atmel processor, which not only define the timer value to generate a (pos,neg,toggle) edge on an output pin but also generate an interrupt. Wish this could be done with an ESP32, because the T-Beam product of LilyGo/TTGo is exactly what i need for my project, including Wifi, BT and LoRa comm, Oled, battery, Neo gps, USB, etc...
Or do you know any other library for the MOTOR PWM control of the ESP32?
Beta Was this translation helpful? Give feedback.
All reactions