Page 1 of 2

how to use esp32 input capture and motor pwm function?

Posted: Fri Jan 06, 2017 9:53 am
by chopin1998
Hi,
I noticed that datasheet said there are 4 pwm modules with input capture function in esp32, but I cannot find REG desc or code snippet on it.

Somebody used that?

Re: how to use esp32 input capture and motor pwm function?

Posted: Fri Jan 06, 2017 2:07 pm
by ESP_Sprite
There's a MPWM unit or two that still has both documentation as well as a driver in editing; both should be released somewhere in the near future.

Re: how to use esp32 input capture and motor pwm function?

Posted: Mon Jan 09, 2017 8:54 am
by chopin1998
ESP_Sprite wrote:There's a MPWM unit or two that still has both documentation as well as a driver in editing; both should be released somewhere in the near future.
Ok, I wanna measure a signal width precisely and fast, so I need hardware input capture function.

If doc/ driver are available, please let me know.

Thank you!

Re: how to use esp32 input capture and motor pwm function?

Posted: Mon Jan 09, 2017 3:26 pm
by kolban
You might get some mileage from a study of the unusually named "Remote" peripheral functions in the ESP32. This is also called "RMT". The name stems from the apparent mapping to an "infrared remote control" interface where we can supply a signal pattern to RMT and RMT will then own the generation of the signal output with extremely fine grained timings. It also appears to be able to handle "incoming" signal parsing. What this means is that it can monitor signals arriving and give you feedback on their arrival. I get the "impression" that this could be used as a powerful signal analyser ... but I'm not sure yet. Sorry about the fluffy post ... but it may be a clue.

Re: how to use esp32 input capture and motor pwm function?

Posted: Tue Jan 10, 2017 7:25 am
by chopin1998
kolban wrote:You might get some mileage from a study of the unusually named "Remote" peripheral functions in the ESP32. This is also called "RMT". The name stems from the apparent mapping to an "infrared remote control" interface where we can supply a signal pattern to RMT and RMT will then own the generation of the signal output with extremely fine grained timings. It also appears to be able to handle "incoming" signal parsing. What this means is that it can monitor signals arriving and give you feedback on their arrival. I get the "impression" that this could be used as a powerful signal analyser ... but I'm not sure yet. Sorry about the fluffy post ... but it may be a clue.
I'll check "RMT" module...

wow!!
I'm reading your b00k, that's GREAT.

Amazing!

Re: how to use esp32 input capture and motor pwm function?

Posted: Wed Jan 11, 2017 10:33 am
by chopin1998
kolban wrote:You might get some mileage from a study of the unusually named "Remote" peripheral functions in the ESP32. This is also called "RMT". The name stems from the apparent mapping to an "infrared remote control" interface where we can supply a signal pattern to RMT and RMT will then own the generation of the signal output with extremely fine grained timings. It also appears to be able to handle "incoming" signal parsing. What this means is that it can monitor signals arriving and give you feedback on their arrival. I get the "impression" that this could be used as a powerful signal analyser ... but I'm not sure yet. Sorry about the fluffy post ... but it may be a clue.
Hi, Kolban

I need parse multi signals, maybe 4-6 channel, so RMT module seems weak, still need hardware input capture function....

Re: how to use esp32 input capture and motor pwm function?

Posted: Wed Jan 11, 2017 12:50 pm
by ESP_Sprite
The RMT can capture up to 8 signals at the same time.

Re: how to use esp32 input capture and motor pwm function?

Posted: Tue Feb 07, 2017 9:15 pm
by fraveydank
I'm actually also very interested in the motor control PWM for determining suitability of the ESP32 for a task or two (unsurprisingly, related to motor controls). Is there any way I could get a peek at info about it, or is it similar to other modules (say, on the ESP8266)? I could possibly use the LED PWM controller for motor control, but it would be good to know of any more purpose-built modules.

Re: how to use esp32 input capture and motor pwm function?

Posted: Wed Apr 05, 2017 3:00 pm
by alangman
We also have an application which requires motor control and are evaluating the ESP32 for that function. Would be great to take a peak at the motor PWM.

Is it possible to provide some early information?

Best
Alan

Re: how to use esp32 input capture and motor pwm function?

Posted: Thu Apr 06, 2017 10:47 am
by BuddyCasino
Not sure if that helps anyone, but I'm using the LED peripheral to generate PWM pulses to control a servo:

Code: Select all

#include <math.h>
#include "driver/ledc.h"
#include "esp_err.h"

#define MOTOR_PWM_CHANNEL LEDC_CHANNEL_2
#define MOTOR_PWM_TIMER LEDC_TIMER_1
#define MOTOR_PWM_BIT_NUM LEDC_TIMER_10_BIT

#define PWM_PIN GPIO_NUM_23

void motor_pwm_init(void)
{
    ledc_channel_config_t ledc_channel = { 0 };

    ledc_channel.gpio_num = PWM_PIN;
    ledc_channel.speed_mode = LEDC_HIGH_SPEED_MODE;
    ledc_channel.channel = MOTOR_PWM_CHANNEL;
    ledc_channel.intr_type = LEDC_INTR_DISABLE;
    ledc_channel.timer_sel = MOTOR_PWM_TIMER;
    ledc_channel.duty = 0;

    ledc_timer_config_t ledc_timer = { 0 };
    ledc_timer.speed_mode = LEDC_HIGH_SPEED_MODE;
    ledc_timer.bit_num = MOTOR_PWM_BIT_NUM;
    ledc_timer.timer_num = MOTOR_PWM_TIMER;
    ledc_timer.freq_hz = 22050;

    ESP_ERROR_CHECK(ledc_channel_config(&ledc_channel));
    ESP_ERROR_CHECK(ledc_timer_config(&ledc_timer));
}

void motor_pwm_set(uint32_t duty)
{
    ESP_ERROR_CHECK(
            ledc_set_duty(LEDC_HIGH_SPEED_MODE, MOTOR_PWM_CHANNEL, duty));
    ESP_ERROR_CHECK(
            ledc_update_duty(LEDC_HIGH_SPEED_MODE, MOTOR_PWM_CHANNEL));
}