RMT channel 0 with high evt_thresh in rmt_set_tx_thr_intr_en fails.

progit
Posts: 4
Joined: Mon Jul 01, 2019 3:10 pm

RMT channel 0 with high evt_thresh in rmt_set_tx_thr_intr_en fails.

Postby progit » Mon Jul 15, 2019 11:27 pm

Hello All,

I am trying to send pulses (to generate a square wave with RMT). However, I am having a problem with the rmt_set_tx_thr_intr_en function. It seems like I cannot set the evt_thresh to any uint16_t value.
For example, when I set evt_thresh to 240, thing works fine. Increasing evt_thresh to 260 ( as in code below) gives me this error:
rmt: rmt_set_tx_thr_intr_en(380): RMT EVT THRESH ERR


Any ideas on how I send a larger value to evt_thresh?

Code: Select all


    num_items = 2;
    items = calloc(num_items, sizeof(*items));

    items[0].duration0 = 3;
    items[0].level0 = 1;
    items[0].duration1 = 3;
    items[0].level1 = 0;
    // terminate sequence with a zero-duration item
    items[1].duration0 = 0;
    items[1].level0 = 0;

    config.rmt_mode = RMT_MODE_TX;
    config.channel = RMT_TX_CHANNEL;
    config.gpio_num = RMT_TX_GPIO;
    config.mem_block_num = 8;
    config.tx_config.loop_en = true;
    config.tx_config.carrier_en = false;
    config.tx_config.idle_output_en = true;
    config.tx_config.idle_level = RMT_IDLE_LEVEL_LOW;
    config.tx_config.carrier_level = RMT_CARRIER_LEVEL_HIGH;
    config.clk_div = 200;
    
    int pulses = 260;
    rmt_fill_tx_items(RMT_TX_CHANNEL, (rmt_item32_t *)items, num_items, 0);
    rmt_set_tx_thr_intr_en(RMT_TX_CHANNEL, true, pulses);
Thanks.
Progit.


progit
Posts: 4
Joined: Mon Jul 01, 2019 3:10 pm

Re: RMT channel 0 with high evt_thresh in rmt_set_tx_thr_intr_en fails.

Postby progit » Tue Jul 16, 2019 3:32 pm

Thanks. That clarifies why 256 is the max no of events I can send in one TX.

I was mislead by the uint16_t to think that it might have been more.

As an aside, why not just say :
esp_err_t rmt_set_tx_thr_intr_en(rmt_channel_t channel, bool en, uint8_t evt_thresh)
instead of
esp_err_t rmt_set_tx_thr_intr_en(rmt_channel_t channel, bool en, uint16_t evt_thresh) ?

This would help beginners like me.

Who is online

Users browsing this forum: grginho, tomy983 and 269 guests