Using rmt_set_pin to change the pin bound to an RMT channel
Posted: Sun Apr 22, 2018 2:32 am
Hello!
I am using the RMT peripheral to drive RGB LEDs, and I have a general driver for the FastLED library that supports up to eight outputs using the eight available RMT channels.
Recently, I have been working on a new version that supports more outputs by reusing RMT channels when they complete their transmission. For this to work, however, I need to be able to change the gpio pin associated with a particular RMT channel. What I am doing right now looks like this:
0. Attach two RGB strips (e.g., WS2812) to pins X and Y (the exact numbers are not important)
1. configure channel 0 for pin X
2. send all data on channel 0
3. change channel 0 to pin Y using rmt_set_pin
4. send all data on channel 1
I don't get any explicit errors, but the output is all mixed up. It looks sort of like the data is going to *both* pins in step (4) -- the LEDs are displaying the right colors, but on *both* strips.
For comparison, if I run the exact same code, but use a different RMT channel for steps (3) and (4), it all works perfectly.
Am I missing something here? Do I need to explicitly tell the gpio matrix thing *not* to use pin X anymore?
Any help would be greatly appreciated!
Thanks!
I am using the RMT peripheral to drive RGB LEDs, and I have a general driver for the FastLED library that supports up to eight outputs using the eight available RMT channels.
Recently, I have been working on a new version that supports more outputs by reusing RMT channels when they complete their transmission. For this to work, however, I need to be able to change the gpio pin associated with a particular RMT channel. What I am doing right now looks like this:
0. Attach two RGB strips (e.g., WS2812) to pins X and Y (the exact numbers are not important)
1. configure channel 0 for pin X
2. send all data on channel 0
3. change channel 0 to pin Y using rmt_set_pin
4. send all data on channel 1
I don't get any explicit errors, but the output is all mixed up. It looks sort of like the data is going to *both* pins in step (4) -- the LEDs are displaying the right colors, but on *both* strips.
For comparison, if I run the exact same code, but use a different RMT channel for steps (3) and (4), it all works perfectly.
Am I missing something here? Do I need to explicitly tell the gpio matrix thing *not* to use pin X anymore?
Any help would be greatly appreciated!
Thanks!