Page 1 of 1

RMT initialization - bug?

Posted: Thu Sep 07, 2017 10:35 pm
by permal
Hi,

I'm trying to get RMT working, but it currently always hangs indefinitely on rmt_write_items when wait_tx_done is true, regardless of how few or many items I try to send.

This is how I initialize my RMT channel (0), is there something missing?

Code: Select all

                rmt_set_pin(channel, RMT_MODE_TX, io_pin);
                rmt_set_clk_div(channel, clock_divider);
                rmt_set_source_clk(channel, RMT_BASECLK_APB);
                rmt_set_idle_level(channel, false, RMT_IDLE_LEVEL_LOW);
                rmt_set_memory_owner(channel, RMT_MEM_OWNER_TX);
                rmt_set_err_intr_en(channel, false);
                rmt_set_mem_block_num(channel, 1);
                rmt_set_mem_pd(channel, false);
                rmt_set_tx_carrier(channel, false, 0, 0, RMT_CARRIER_LEVEL_LOW);
                rmt_set_tx_loop_mode(channel, true);

                rmt_set_rx_filter(channel, false, 0);
                rmt_set_rx_intr_en(channel, false);

                ESP_ERROR_CHECK(rmt_driver_install(channel, 0, 0));
The entire file can be seen here: https://github.com/PerMalmberg/Smooth/b ... S2812B.cpp

Thanks in advance.

Re: RMT initialization - bug?

Posted: Fri Sep 08, 2017 6:23 pm
by permal
Surely these two blocks can be considered equivalent? If so, there seems to be a bug in the RMT driver because when using the first block of code the driver hangs in rmt_write_items, while using the second one it works as expected.

Code: Select all

      rmt_set_pin(channel, RMT_MODE_TX, io_pin);
                rmt_set_mem_block_num(channel, 1);
                rmt_set_clk_div(channel, clock_divider);
                rmt_set_tx_loop_mode(channel, false);
                rmt_set_tx_carrier(channel, false, 0, 0, RMT_CARRIER_LEVEL_LOW);
                rmt_set_idle_level(channel, false, RMT_IDLE_LEVEL_LOW);
                rmt_set_source_clk(channel, RMT_BASECLK_APB);

                ESP_ERROR_CHECK(rmt_driver_install(channel, 0, 0));

Code: Select all

                rmt_config_t config;
                config.gpio_num = io_pin;
                config.rmt_mode = RMT_MODE_TX;
                config.channel = channel;
                config.clk_div = clock_divider;
                config.mem_block_num = 1;
                config.tx_config.loop_en = 0;
                config.tx_config.carrier_en = 0;
                config.tx_config.idle_output_en = 0;
                config.tx_config.idle_level = RMT_IDLE_LEVEL_LOW;
                config.tx_config.carrier_freq_hz = 0;
                config.tx_config.carrier_level = RMT_CARRIER_LEVEL_HIGH;
                config.tx_config.carrier_duty_percent = 0;
                ESP_ERROR_CHECK(rmt_config(&config));
                ESP_ERROR_CHECK(rmt_driver_install(channel, 0, 0));

Re: RMT initialization - bug?

Posted: Sat Sep 09, 2017 2:28 am
by WiFive

Re: RMT initialization - bug?

Posted: Sat Sep 09, 2017 8:23 am
by permal
Oh. Wish that had been mentioned in the docs among the other APIs.

Thanks WiFive.