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.
RMT fully in background: transmit or abandon
-
- Posts: 54
- Joined: Mon Dec 05, 2016 12:34 am
-
- Posts: 9764
- Joined: Thu Nov 26, 2015 4:08 am
Re: RMT fully in background: transmit or abandon
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
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.KanyeKanye wrote: ↑Thu Jan 10, 2019 7:56 pmHi, 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.
Which IDF version you are using?
Regards,
Ritesh Prajapati
Ritesh Prajapati
-
- Posts: 54
- Joined: Mon Dec 05, 2016 12:34 am
Re: RMT fully in background: transmit or abandon
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.
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
So, As per your explanation it seems like you need faster transmission over RMT interface to do your processing stuffs faster.KanyeKanye wrote: ↑Sun Jan 13, 2019 3:02 pmI 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.
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
Ritesh Prajapati
Who is online
Users browsing this forum: Baidu [Spider], Bing [Bot] and 104 guests