RMT: Transmitting and Receiving on two different channels at same time

bkgoodman
Posts: 45
Joined: Fri Feb 17, 2017 12:41 pm

RMT: Transmitting and Receiving on two different channels at same time

Postby bkgoodman » Sun Jun 04, 2023 5:06 pm

I am working in ESP IDF 4.4.2

I have some off-the-shelf code that I'm working with that do two different things, and both work:

* A library that uses RMT to transmit words to a Neopixel strand
* A library that uses RMT to sniff servo waveforms from an RC remote control receiver

But when I try to use them at the same _time_ - everything goes to hell. The most obvious problem is that both are trying to call `rmt_driver_install` - which apparently you can only do once.

Long story short, I am trying to set them both up at the same time (in short) by doing:

Code: Select all

 rmt_config(&rx_config);
 rmt_set_rx_intr_en(RX_CHAN, true);
 rmt_rx_start(RX_CHAN, 1);

rmt_config(&tx_config);
rmt_set_tx_intr_en(XMIT_CHANNEL,true);
rmt_tx_start(XMIT_CHANNEL, true);

rmt_isr_register(rmt_isr_handler, NULL, 0, NULL);
When I do this - rx works fine, but when I call `rmt_write_items` I get `rmt: rmt_write_items(1124): RMT DRIVER ERR`

Note that the same "write" code works when I initialize it without the rx stuff, and instead use `rmd_driver_install` after the `rmt_config`. But if I continue to do that here, it complains `RMT driver installed, can not install generic ISR handler`.

...but if I call `rmt_driver_install`, it doesn't let me call `rmt_isr_register` which I need to register the ISR.

So I seem to be caught in a catch-22. How can I do this?

I've looked some other Neopixel code that uses a custom ISR in the RMT driver - they seem to use a totally different technique to set up RMT (bit bashing, not using RMT library), and manually setting up interupts outside of RMT framework. Do I have to do something like that??

Does this get better if I go to 5.0 (That would be painful for many reasons...)

MicroController
Posts: 1137
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: RMT: Transmitting and Receiving on two different channels at same time

Postby MicroController » Sun Jun 04, 2023 8:15 pm

If all else fails, it would be pretty easy to use a GPIO interrupt to measure the servo PWM; after all, the minimum pulse width would be ~500 micro-seconds and the ISR wouldn't have to do much more than storing a current timestamp in RAM @ 100Hz.

Who is online

Users browsing this forum: No registered users and 180 guests