Hi,
For reference, here's a version of the code which does work. When I was working on this I struggled to find any example so hopefully this will help if anyone else is looking. Thanks for all the help.
Ta
// Test code to identify the configuration and control of motors using MCPWM on an ESP32 ...
Search found 8 matches
- Fri Jan 24, 2025 1:27 pm
- Forum: Hardware
- Topic: ESP32 will not output PWM signal
- Replies: 11
- Views: 11602
- Fri Dec 13, 2024 4:17 pm
- Forum: Hardware
- Topic: ESP32 will not output PWM signal
- Replies: 11
- Views: 11602
Re: ESP32 will not output PWM signal
Hi,
Good idea. I'll look at that for the final code.
Thanks for your help.
Andy
Good idea. I'll look at that for the final code.
Thanks for your help.
Andy
- Wed Dec 11, 2024 8:31 pm
- Forum: Hardware
- Topic: ESP32 will not output PWM signal
- Replies: 11
- Views: 11602
Re: ESP32 will not output PWM signal
Hi,
I added more GPIO captures in and eventually spotted I had my case statements wrong - UP was 1, 2, 3,4 and DOWN is 0, 1, 2, 3. Doh!!
I have working PWM signals now.
I'm still unsure why or how I managed to lose them in the first place but at least I have something to work with now.
I ...
I added more GPIO captures in and eventually spotted I had my case statements wrong - UP was 1, 2, 3,4 and DOWN is 0, 1, 2, 3. Doh!!
I have working PWM signals now.
I'm still unsure why or how I managed to lose them in the first place but at least I have something to work with now.
I ...
- Wed Dec 11, 2024 4:20 pm
- Forum: Hardware
- Topic: ESP32 will not output PWM signal
- Replies: 11
- Views: 11602
Re: ESP32 will not output PWM signal
Hi,
Update on this....
I've tried a brand new device and still got nothing however, in re-trying my original MCPWM code I now have the code generating a PWM signal from GPIO16 but ONLY when ramping DOWN from peak to 0 Duty cycle. It's the same call to ESP_ERROR_CHECK(mcpwm_comparator_set_compare ...
Update on this....
I've tried a brand new device and still got nothing however, in re-trying my original MCPWM code I now have the code generating a PWM signal from GPIO16 but ONLY when ramping DOWN from peak to 0 Duty cycle. It's the same call to ESP_ERROR_CHECK(mcpwm_comparator_set_compare ...
- Tue Dec 03, 2024 7:02 pm
- Forum: Hardware
- Topic: ESP32 will not output PWM signal
- Replies: 11
- Views: 11602
Re: ESP32 will not output PWM signal
Hi,
Thanks again, this is really helping.
OK, I guess the numbers are right. Since my ESP-WROOM-32 only has a 40MHz clock I need to think practical so 100 steps would be fine putting resolution_hz at 1.6MHz and period_ticks at 100.
I tried the same ESP32 with a simple blink LED automation ...
Thanks again, this is really helping.
OK, I guess the numbers are right. Since my ESP-WROOM-32 only has a 40MHz clock I need to think practical so 100 steps would be fine putting resolution_hz at 1.6MHz and period_ticks at 100.
I tried the same ESP32 with a simple blink LED automation ...
- Tue Dec 03, 2024 3:52 pm
- Forum: Hardware
- Topic: ESP32 will not output PWM signal
- Replies: 11
- Views: 11602
Re: ESP32 will not output PWM signal
Hi,
Many thanks for your help.
I never was great at the maths side of programming :-). Re-reading the Programming Guide I can see that the "tick resolution is set in resolution_hz" so that makes sense with what you are saying - in my case each period_tick is 950/16384 ~ 0.058 ~ 17Hz. I would ...
Many thanks for your help.
I never was great at the maths side of programming :-). Re-reading the Programming Guide I can see that the "tick resolution is set in resolution_hz" so that makes sense with what you are saying - in my case each period_tick is 950/16384 ~ 0.058 ~ 17Hz. I would ...
- Mon Dec 02, 2024 9:20 am
- Forum: Hardware
- Topic: ESP32 will not output PWM signal
- Replies: 11
- Views: 11602
Re: ESP32 will not output PWM signal
Hi,
Historical as the code was ported from Arduino where delay() is a blocking function. I didn't know it was non-blocking on ESP32 so thanks.
All my debug output indicates that the code is working, just no PWM signal:
09:26:55.314 -> ESP32 MCPWM Debug Output - V1.20
09:26:55.751 -> Create ...
Historical as the code was ported from Arduino where delay() is a blocking function. I didn't know it was non-blocking on ESP32 so thanks.
All my debug output indicates that the code is working, just no PWM signal:
09:26:55.314 -> ESP32 MCPWM Debug Output - V1.20
09:26:55.751 -> Create ...
- Sun Dec 01, 2024 3:33 pm
- Forum: Hardware
- Topic: ESP32 will not output PWM signal
- Replies: 11
- Views: 11602
ESP32 will not output PWM signal
Hi,
I have a project developed using the Arduino IDE and an Arduino Nano to drive motors on an ROV. This code has been working for a couple of years in various versions. I now need to upgrade to an ESP32-WROOM-32 and, to drive the motors, have delved into the latest mcpwm API. It's taken my brain ...
I have a project developed using the Arduino IDE and an Arduino Nano to drive motors on an ROV. This code has been working for a couple of years in various versions. I now need to upgrade to an ESP32-WROOM-32 and, to drive the motors, have delved into the latest mcpwm API. It's taken my brain ...