RMT - problem with setting precise item duration

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

RMT - problem with setting precise item duration

Postby Deouss » Wed Dec 12, 2018 4:01 pm

I am currently working on project that uses RMT. It is just sending impulses of variable duration and pauses in time.
However I have troubles with properly setting time duration of RMT items. Looks like it is related to clock divider.
I followed esp example but still it does not work and time durations come out too short
Some questions - what is the proper way to set precise time in microseconds for RMT items?
Also what are the recommended values for clk_div, what exactly is idle_level, idle_output_en and mem_block_num...
How all that works? I read documentation saying that there are some limits for number of items - so do I need to set something in config?
For now I need items basically with 500us impulses or multiplication of 500us

Thanks

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

Re: RMT - problem with setting precise item duration

Postby ESP_Sprite » Thu Dec 13, 2018 4:34 am

What specific problems are you getting?

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: RMT - problem with setting precise item duration

Postby Deouss » Thu Dec 13, 2018 1:52 pm

The time duration in us is different from what I set up.
I use calculations from the esp examples - RMT_TICK_10_US = (80000000/RMT_CLK_DIV/100000), RMT_CLK_DIV = 100
So 500us as a result on scope gives me strange result and less than 500 - between 100-300 -I must check.
Microsecond values look ok so I don't understand what could decrease the signal.
I also must use 40-70milisec pauses and it all is supposed to go to RF transmitter.
How multiplying clock counter is done by RMT? Is it float calculations or integer division.
And what are the best divider values for specific durations and scale?

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

Re: RMT - problem with setting precise item duration

Postby ESP_Sprite » Sat Dec 15, 2018 3:34 am

Hmm, to my knowledge that should work. Do you happen to enable sleep modes or something somewhere?

keckert
Posts: 8
Joined: Tue Apr 03, 2018 8:44 pm

Re: RMT - problem with setting precise item duration

Postby keckert » Wed Jan 02, 2019 5:43 pm

Calculate RMT frequencies:
  • 80 MHz: ESP32 Source Clock frequency
  • RMT_DIV_CNT_CHn: RMT Channel Clock Divisor
  • RMT Channel Clock frequency = ESP32 Source Clock frequency / RMT_DIV_CNT_CHn
  • RMT_CARRIER_HIGH_CHn: RMT Carrier Clock high duration, in ESP32 Source Clock periods
  • RMT_CARRIER_LOW_CHn: RMT Carrier Clock low duration, in ESP32 Source Clock periods
  • RMT Carrier Clock frequency = ESP32 Source Clock frequency / (RMT_CARRIER_HIGH_CHn + RMT_CARRIER_LOW_CHn)
  • RMT Carrier Clock duty cycle = RMT_CARRIER_HIGH_CHn / (RMT_CARRIER_HIGH_CHn + RMT_CARRIER_LOW_CHn)
  • RMT Pulse Duration Resolution = One RMT Channel Clock period
  • RMT Pulse Maximum Duration = (2^15) * RMT Channel Clock period
Note that the RMT output is modulated at the Carrier frequency. Your duration may be 500uS, but your output pulse can be shorter than 500uS if your Carrier Clock high and low settings result in shorter Carrier Clock durations than 500uS.

Who is online

Users browsing this forum: Google [Bot] and 343 guests