Hi, I have a question about using FastLED library with Teensy 3.2.

Hi, I have a question about using FastLED library with Teensy 3.2. The FastLED web site claims to support hardware SPI with Teensy 3 / 3.1.

I would assume (hope) that this extends to other 3.x boards. I tried checking this on a 3.2 board. I used several forms of the ‘FastLED.addLeds’ method:

FastLED.addLeds<DOTSTAR, RGB>(leds, NUM_LEDS);
FastLED.addLeds<DOTSTAR, 11, 13, RGB>(leds, NUM_LEDS);
FastLED.addLeds<DOTSTAR, 7, 14, RGB>(leds, NUM_LEDS);

I then checked the Pin Control Registers for the SPI data and clock pins. In all cases, the MUX field in these registers was set to 3b001. I believe this is the setting for normal GPIO. The Hardware SPI setting for all of these pins is ALT2 (MUX = 3b010). All this leads me to believe that the FastLED library is using Bit-Bang SPI rather than Hardware SPI on (at least) the Teensy 3.2.

Would appreciate it if someone could check my analysis and / or provide their own experience.

Thanks.

https://github.com/FastLED/FastLED/wiki/SPI-Hardware-or-Bit-banging

I reset the registers involved at the end of writing out each frame - it’s how the four way spi output hack is done - it’s also why you checking the registers isn’t useful for figuring out what’s going on

Hi Thanks. So, will all of the FastLED.addLeds call that I tried invoke Hardware SPI?

I resorted to peeking at the registers because I’m only an Old School ‘C’ coder and I don’t yet know enough C++ to follow all the twists and turns through the library code.

Here’s your same question answered over at the PJRC forum. https://forum.pjrc.com/threads/42427-FastLED-Library-and-Hardware-SPI

Yes, saw that. Thanks.