Carrier synchronization interrupt method using MCPWM

fluxdesigner
Posts: 2
Joined: Wed Jul 06, 2022 3:33 pm

Carrier synchronization interrupt method using MCPWM

Postby fluxdesigner » Wed Jul 06, 2022 4:19 pm

I am programming the FOC control of a three-phase brushless motor using MCPWM. At that time, I want to perform processing in synchronization with the carrier frequency. Does anyone know how to implement carrier sync interrupts on the ESP32?
For example, the RP2040 (Raspberry Pi Pico) C / C ++ SDK provides the following functions.

pwm_set_irq_enabled (slice *, true);
irq_set_exclusive_handler (PWM_IRQ_WRAP, arbitrary function);
irq_set_enabled (PWM_IRQ_WRAP, true);

Thank you very much for your kind support.

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

Re: Carrier synchronization interrupt method using MCPWM

Postby lbernstone » Thu Jul 07, 2022 7:44 am

I think what you are talking about is over my head, but the documentation is at https://docs.espressif.com/projects/esp ... ynchronize
https://github.com/espressif/esp-idf/tr ... nc_example

fluxdesigner
Posts: 2
Joined: Wed Jul 06, 2022 3:33 pm

Re: Carrier synchronization interrupt method using MCPWM

Postby fluxdesigner » Sun Jul 10, 2022 12:21 pm

Thank you for your reply.
I understood that what you taught me was "how to synchronize three PWMs to operate".
Certainly, this content is a very important point for FOC control with ESP32.

However, what I wanted to know this time was "a method of generating an interrupt in synchronization with a PWM carrier and operating an arbitrary function".

https://github.com/simplefoc/Arduino-FO ... 32_mcu.cpp

Fortunately, as a result of conducting a survey including the information of the link you gave me, I found that the following project embodies what I want to know.
The important point is the part that uses the "mcpwm_isr_register () function".

thank you for your cooperation. :P
Thank you very much.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 64 guests