Forum Rule: Always post complete source code & details to reproduce any issue!
-
Inverting OctoWS2811 output in software
I'm building a project to control 8 LED strips using the OctoWS2811 library on a Teensy 4.1. I was planning on using two hex non-inverting schmitt-trigger ICs I thought I had around for level-shifting the output, but unfortunately what I had instead was otherwise pin-compatible inverting schmitt-triggers. I didn't notice that mistake until after having assembled a prototype with the wrong IC.
Is there perhaps a way of easily inverting the output signal in software before it gets re-inverted again by the schmitt-triggers as to not require a bunch of rework of the hardware I have already built? I've tried to have a look at OctoWS2811_imxrt.cpp, which is where I think I'd need to make the changes I want, but I haven't quite been able to follow what's going on in all the low-level code to find the right place to make that modification.
Thanks!
-
Member
-
Senior Member

Originally Posted by
pilotplater
Between line 282 to 290 is the actual pin writes... I think FTM1_C1SC and FTM1_C0SC are some kind of registers for the corresponding digital pins
Those writes are just configuring the timers, which are used to generate hardware trigger events to cause the DMA to move data from memory to GPIO. And the "FTM" timers are only on Teensy 3. Look for the #ifdef in the code to see which hardware.

Originally Posted by
rafl
Is there perhaps a way of easily inverting the output signal in software before it gets re-inverted again by the schmitt-triggers as to not require a bunch of rework of the hardware I have already built?
Look for the DMA destination addresses. It's these lines in OctoWS2811_imxrt.cpp.
Code:
dma1.TCD->DADDR = &GPIO1_DR_SET;
dma2next.TCD->DADDR = &GPIO1_DR_CLEAR;
dma3.TCD->DADDR = &GPIO1_DR_CLEAR;
dma2.TCD->DADDR = &GPIO1_DR_CLEAR;
dma2.TCD->DADDR = &GPIO1_DR_CLEAR;
Change every CLEAR to SET, and the one SET to CLEAR. Kind of like the trick where the magician yanks the table cloth out and all the dishes & silverware stay in place...
-
Member
-
Awesome - thank you both!
That saved me a whole bunch of labour and also gave me some interesting insights into how the library works.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules