Usage of rmt_fill_tx_items and rmt_tx_start
Posted: Wed Jul 31, 2024 7:58 pm
H ithere,
I need to drive some Serial adressable RGB-LEDs (WS2813C). I use the RMT unit for that to do it as fast as possible.
Due to the histry of my project it is for both RP2040 and ESP, and I want to keep it as similar as possible.
Currently, I use a timer interrupt for setting my LEDs, so that blocked loops do not affect the LEDs.
I got RMT working, but I learned that cannot be called from an ISR.
So, I wanted to try the other variant mentioned in the IDF docu:
and
While there is no suitable example and no further information in the IDF docu, I tried that:
but that ended up in a totally scrambled signal and weired behaviour of the LEDs.
So I tried that
That resulted in the correct sending of 21 out of 96 rmt_items.
Next thing I tried was using
but that also resulted in scrambled bits, and tx_end_callback is never called !
Could you please point me to the correct usage of that rmt lib ?
I want to trigger (without delay / non blocking) the sending of a series of rmt items (e.g. 96) from a timer isr.
It should stop the transmission an go to idle after that. How do I do that?
I need to drive some Serial adressable RGB-LEDs (WS2813C). I use the RMT unit for that to do it as fast as possible.
Due to the histry of my project it is for both RP2040 and ESP, and I want to keep it as similar as possible.
Currently, I use a timer interrupt for setting my LEDs, so that blocked loops do not affect the LEDs.
I got RMT working, but I learned that
Code: Select all
rmt_write_items
So, I wanted to try the other variant mentioned in the IDF docu:
Code: Select all
rmt_fill_tx_items
Code: Select all
rmt_tx_start
Code: Select all
rmt_tx_stop
While there is no suitable example and no further information in the IDF docu, I tried that:
Code: Select all
rmt_fill_tx_items((rmt_channel_t)_rmtChannel, _rmtItems, _ledCount * BITS_PER_LED_CMD, 0);
rmt_tx_start((rmt_channel_t)_rmtChannel, true);
So I tried that
Code: Select all
rmt_fill_tx_items((rmt_channel_t)_rmtChannel, _rmtItems, _ledCount * BITS_PER_LED_CMD, 0);
rmt_tx_start((rmt_channel_t)_rmtChannel, true);
rmt_wait_tx_done((rmt_channel_t)_rmtChannel, portMAX_DELAY);
rmt_tx_stop((rmt_channel_t)_rmtChannel);
Next thing I tried was using
Code: Select all
rmt_register_tx_end_callback
Code: Select all
void tx_end_callback(rmt_channel_t channel, void* arg)
{
rmt_tx_stop(channel);
digitalWrite(7, 1); // debug
}
...
rmt_config(&config); // ToDo Error Handling
rmt_driver_install(config.channel, 0, 0); // ToDo Error Handling
rmt_register_tx_end_callback(tx_end_callback, NULL);
..
Could you please point me to the correct usage of that rmt lib ?
I want to trigger (without delay / non blocking) the sending of a series of rmt items (e.g. 96) from a timer isr.
It should stop the transmission an go to idle after that. How do I do that?