how to use esp32 input capture and motor pwm function?

chopin1998
Posts: 14
Joined: Sat Dec 24, 2016 8:09 am

how to use esp32 input capture and motor pwm function?

Postby chopin1998 » Fri Jan 06, 2017 9:53 am

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?

ESP_Sprite
Posts: 9711
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Fri Jan 06, 2017 2:07 pm

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.

chopin1998
Posts: 14
Joined: Sat Dec 24, 2016 8:09 am

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

Postby chopin1998 » Mon Jan 09, 2017 8:54 am

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!

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

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

Postby kolban » Mon Jan 09, 2017 3:26 pm

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.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

chopin1998
Posts: 14
Joined: Sat Dec 24, 2016 8:09 am

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

Postby chopin1998 » Tue Jan 10, 2017 7:25 am

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!

chopin1998
Posts: 14
Joined: Sat Dec 24, 2016 8:09 am

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

Postby chopin1998 » Wed Jan 11, 2017 10:33 am

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....

ESP_Sprite
Posts: 9711
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Wed Jan 11, 2017 12:50 pm

The RMT can capture up to 8 signals at the same time.

fraveydank
Posts: 3
Joined: Tue Feb 07, 2017 9:13 pm

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

Postby fraveydank » Tue Feb 07, 2017 9:15 pm

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.

alangman
Posts: 5
Joined: Wed Apr 05, 2017 12:47 pm

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

Postby alangman » Wed Apr 05, 2017 3:00 pm

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

BuddyCasino
Posts: 263
Joined: Sun Jun 19, 2016 12:00 am

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

Postby BuddyCasino » Thu Apr 06, 2017 10:47 am

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));
}

Who is online

Users browsing this forum: No registered users and 61 guests