how to use esp32 input capture and motor pwm function?
-
- Posts: 14
- Joined: Sat Dec 24, 2016 8:09 am
how to use esp32 input capture and motor pwm function?
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?
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?
-
- Posts: 9764
- Joined: Thu Nov 26, 2015 4:08 am
Re: how to use esp32 input capture and motor pwm function?
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.
-
- Posts: 14
- Joined: Sat Dec 24, 2016 8:09 am
Re: how to use esp32 input capture and motor pwm function?
Ok, I wanna measure a signal width precisely and fast, so I need hardware input capture function.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.
If doc/ driver are available, please let me know.
Thank you!
Re: how to use esp32 input capture and motor pwm function?
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
-
- Posts: 14
- Joined: Sat Dec 24, 2016 8:09 am
Re: how to use esp32 input capture and motor pwm function?
I'll check "RMT" module...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.
wow!!
I'm reading your b00k, that's GREAT.
Amazing!
-
- Posts: 14
- Joined: Sat Dec 24, 2016 8:09 am
Re: how to use esp32 input capture and motor pwm function?
Hi, Kolbankolban 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 need parse multi signals, maybe 4-6 channel, so RMT module seems weak, still need hardware input capture function....
-
- Posts: 9764
- Joined: Thu Nov 26, 2015 4:08 am
Re: how to use esp32 input capture and motor pwm function?
The RMT can capture up to 8 signals at the same time.
-
- Posts: 3
- Joined: Tue Feb 07, 2017 9:13 pm
Re: how to use esp32 input capture and motor pwm function?
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?
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
Is it possible to provide some early information?
Best
Alan
-
- Posts: 263
- Joined: Sun Jun 19, 2016 12:00 am
Re: how to use esp32 input capture and motor pwm function?
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 91 guests