RMT fully in background: transmit or abandon

KanyeKanye
Posts: 54
Joined: Mon Dec 05, 2016 12:34 am

RMT fully in background: transmit or abandon

Postby KanyeKanye » 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.

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: RMT fully in background: transmit or abandon

Postby ESP_Sprite » Sat Jan 12, 2019 5:38 am

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.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: RMT fully in background: transmit or abandon

Postby Ritesh » Sun Jan 13, 2019 10:54 am

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?
Regards,
Ritesh Prajapati

KanyeKanye
Posts: 54
Joined: Mon Dec 05, 2016 12:34 am

Re: RMT fully in background: transmit or abandon

Postby KanyeKanye » 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.

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: RMT fully in background: transmit or abandon

Postby Ritesh » Tue Jan 15, 2019 4:36 am

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
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: No registered users and 186 guests