The "clock ticks" used for both carrier wave periods and RMT transmission entry lengths are determined from the RMT clock frequency, which can be sourced from the APB bus clock or the REF_TICK clock. See TRM section 15.2.3 "Clock" in the RMT chapter.
The values written to RMT_CARRIER_HIGH_CHn and RMT_CARRIER_LOW_CHn both use this unit, as well as the memory block entries. So if you write a single entry with one "on" pulse, you will want the "on" entry length to be N * (RMT_CARRIER_HIGH_CHn + RMT_CARRIER_LOW_CHn), where N is the number of clock cycles. Followed immediately by a zero-length "off" pulse to terminate the RMT state machine.
If you've programmed the RMT like this and you're still getting the slightly short first & last carrier wave edges shown in the scope trace, can you please post the full code you're using?
Thanks Angus!
I think I see RMT_CARRIER_HIGH_CHn being referenced as RMT.carrier_duty_ch[channel].high.
But I'm not sure if changing that will solve the phase issue. I tried changing the 'items' and placing a 1/4 wave worth of 0 before the pulse of '1', and changing the pulse length and ended up with a fairly regular set of clock edges:

- NewFile4.png (47.19 KiB) Viewed 28723 times
Code: Select all
config.tx_config.carrier_duty_percent = 50;
config.tx_config.carrier_freq_hz = 2000;
config.tx_config.carrier_level = 1;
config.clk_div = 255;
and sending out two items [will change to 1 later]:
Code: Select all
{{{ 128, 0, 1024, 1 }}}, // used to be dot
//
{{{ 32767, 0, 32767, 0 }}}, // SPACE
and ended up with what looks like 7 wave cycles. If I've done the math right:
ABP clock 80Mhz/255 divider = 313725 ticks?
313725 / 2000 freq = 156 counts is a full wave?
-armand