Page 1 of 1

RMT fully in background: transmit or abandon

Posted: Thu Jan 10, 2019 7:56 pm
by KanyeKanye
Hi, I would use RMT tx fully in background:
Main loop executes function for sending: if it is possible, it transmits data in background (rmt_write_items() with last parameter wait_tx_done equal false) or, if semaphore was not given (still sending prev frame), it abandon transmitting that time. Will try next time. No waiting no delays.
How to do it?
There is a local semaphore in p_rmt_obj but I cant access it outside driver/rmt.c. Additionaly this semaphore waits to infinity for permission (xSemaphoreTake(p_rmt->tx_sem, portMAX_DELAY) inside rmt_write_items). As far I understand I also cannot register own isr because rmt_driver_isr_default inside driver.

Re: RMT fully in background: transmit or abandon

Posted: Sat Jan 12, 2019 5:38 am
by ESP_Sprite
Easiest way is to do RMT communications in a separate task, so rmt_write_items can happily block without blocking the rest of your code.

Re: RMT fully in background: transmit or abandon

Posted: Sun Jan 13, 2019 10:54 am
by Ritesh
KanyeKanye wrote:
Thu Jan 10, 2019 7:56 pm
Hi, I would use RMT tx fully in background:
Main loop executes function for sending: if it is possible, it transmits data in background (rmt_write_items() with last parameter wait_tx_done equal false) or, if semaphore was not given (still sending prev frame), it abandon transmitting that time. Will try next time. No waiting no delays.
How to do it?
There is a local semaphore in p_rmt_obj but I cant access it outside driver/rmt.c. Additionaly this semaphore waits to infinity for permission (xSemaphoreTake(p_rmt->tx_sem, portMAX_DELAY) inside rmt_write_items). As far I understand I also cannot register own isr because rmt_driver_isr_default inside driver.
So, Would you please provide more details like what issue you are facing right now and what you need for RMT interface as we have used TX and RX with RMT interface on multiple channels without any issue into our project.

Which IDF version you are using?

Re: RMT fully in background: transmit or abandon

Posted: Sun Jan 13, 2019 3:02 pm
by KanyeKanye
I am using RMT to interact with couple ws2812 LEDs.
In my code there is a main loop (main task) which reads sensors and process results some way. At the end of the loop, accordingly to the result, I change color of a led.
Sensor reading is fast. Its processing also, but communication with leds tooks much longer than rest of thing. I would send new, actual, data to leds only if last package was succesfully send. If loop has finished and transmission to led is not finished, I would process new sensor data and try changing led's color next time.
Now I cant do it because rmt_write_items waits for its semaphore without any time limit.

Re: RMT fully in background: transmit or abandon

Posted: Tue Jan 15, 2019 4:36 am
by Ritesh
KanyeKanye wrote:
Sun Jan 13, 2019 3:02 pm
I am using RMT to interact with couple ws2812 LEDs.
In my code there is a main loop (main task) which reads sensors and process results some way. At the end of the loop, accordingly to the result, I change color of a led.
Sensor reading is fast. Its processing also, but communication with leds tooks much longer than rest of thing. I would send new, actual, data to leds only if last package was succesfully send. If loop has finished and transmission to led is not finished, I would process new sensor data and try changing led's color next time.
Now I cant do it because rmt_write_items waits for its semaphore without any time limit.
So, As per your explanation it seems like you need faster transmission over RMT interface to do your processing stuffs faster.

As we have checked and reviewed RMT interface TX and TX code before when we were working over that we found that it will wait till data communication will be completed.

Are you using ring buffer to read/write data over RMT interface or directly reading data from RMT Interface?

You might need to change RMT Interface driver to do your stuffs for that. Still let me know if you need any help for that