RMT – The Remote Peripheral, or, Whats wrong with this code... please..

Don Warr
Posts: 11
Joined: Fri Oct 19, 2018 10:01 am

RMT – The Remote Peripheral, or, Whats wrong with this code... please..

Postby Don Warr » Sun Oct 28, 2018 9:12 am

Hi all, I am trying to evaluate the RMT of the ESP32.. I have decades of expertise with Micro Chip but I like the look of this ESP device..
Now, although there's not many examples for the RMT, and even less using Arduino, I have found THIS example which works for someone to get 3uS pulses . It has ONE line that won't compile for me and editing it out,, it compiles but nothing happens... I am simply wanting to see a pulse or pulses as proof of concept, Any insight into this, would certainly be appreciated...

Code: Select all

// ESP32: Sending short pulses with the RMT
// http://www.buildlog.net/blog/2017/11/esp32-sending-short-pulses-with-the-rmt/

#include "driver/rmt.h"
#define STEP_PIN  GPIO_NUM_17

// Reference https://esp-idf.readthedocs.io/en/v1.0/api/rmt.html
 
rmt_config_t config;
rmt_item32_t items[1];
 
void setup() 
{
  config.rmt_mode = RMT_MODE_TX;
  config.channel = RMT_CHANNEL_0;
  config.gpio_num = STEP_PIN;
  config.mem_block_num = 1;
  config.tx_config.loop_en = 0;
  config.tx_config.carrier_en = 0;
  config.tx_config.idle_output_en = 1;
  config.tx_config.idle_level = RMT_IDLE_LEVEL_LOW;
  config.tx_config.carrier_level = RMT_CARRIER_LEVEL_HIGH;
  config.clk_div = 80; // 80MHx / 80 = 1MHz 0r 1uS per count
 
  //rmt_config(&config);  //<< Line Will not Compile
  rmt_driver_install(config.channel, 0, 0);  //  rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size, int rmt_intr_num)
   
  items[0].duration0 = 3;
  items[0].level0 = 1;
  items[0].duration1 = 0;
  items[0].level1 = 0;  
}
 
void loop() 
{
  // esp_err_t rmt_write_items(rmt_channel_t channel, rmt_item32_t *rmt_item, int item_num, bool wait_tx_done)
  rmt_write_items(config.channel, items, 1, 0);
  delay(1);
}

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: RMT – The Remote Peripheral, or, Whats wrong with this code... please..

Postby WiFive » Sun Oct 28, 2018 10:47 am

&
Somewhere it was html encoded

Don Warr
Posts: 11
Joined: Fri Oct 19, 2018 10:01 am

Re: RMT – The Remote Peripheral, or, Whats wrong with this code... please..

Postby Don Warr » Sun Oct 28, 2018 11:01 am

Thanks for a Reply WiFive , I'm not sure of what you mean "html encoded" but CAN this code work if I leave out that line...?? Or what can I do to get this code working...


Don Warr
Posts: 11
Joined: Fri Oct 19, 2018 10:01 am

Re: RMT – The Remote Peripheral, or, Whats wrong with this code... please..

Postby Don Warr » Sun Oct 28, 2018 2:07 pm

Well thank you WiFive,,,, The program above, Now works great, and generates a wonderful square wave, I replaced the 1 line
" rmt_config(&config); //<< Line Will not Compile " with
"rmt_config(&config); //<< This fixed program ..."

I have searched and googled everywhere to try and find 1 program written for the ESP32 using the Arduino, that could show the RMT generating anything... The above program does this.. Now I can advance to spending days reading and trying to make sense of the
technical_reference_manual which is complicated, as I'm use to using Microchip... Thanks...

Who is online

Users browsing this forum: No registered users and 37 guests