Trying to use FastLED with the Teensy 3.2 and the Propshield.

Trying to use FastLED with the Teensy 3.2 and the Propshield. Everything works fine until I try to also use audio. Then I get what appears to be an SPI conflict and no audio comes out.

The FastLED Documentation says: “Teensy 3/3.1: Will disable the use of the MISO pin while writing led data, but will enable it again afterwards.” but I’m not sure that’s happening, could it be eating the MISO?

Just the fastled setup line “FastLED.addLeds<APA102, BGR>(leds, NUM_LEDS)” stops playFlashRaw from working. Even if I never call “FastLED.show()”

However there is no problem if I use the neopixel library. Obviously I’d MUCH rather use FastLED. Any help is appreciated!

Full Code at https://forum.pjrc.com/threads/44527-playFlashRaw-and-FastLED-incompatible
https://forum.pjrc.com/threads/44406-APA102-PropShield-no-Audio

Fastled doesn’t use the underlying spi library and so it doesn’t play nicely with transactions. It’s on the list of things to fix when I come back to working on the library.

Ah, okay. Thanks for letting me know.

With the help of the PJRC forum we found that SPI.begin(); disables FastLED and allows the audio to play. Then Calling FastLED.addLeds will activate the leds and kill the audio. So it’s possible to switch back and forth. How useful that may be I’m not sure. The question is, are there repercussions from calling FastLED.addLeds so many times? Does it eat memory?

It shouldn’t take up more memory, no. The led controller is created statically.

Then I guess we a have a highly limited but usable work-around, Thanks!

It’s also given me some insight into where I need to tweak things. FastLED’s SPI controllers on teensy reconfigure a bunch of things before the start of writing out each frame - but there are some SPI registers that it doesn’t touch - maybe I should expand the set of registers that get reconfigured on every frame.

Well if you and Paul can get the teensy audio library and FastLed talking properly we are going to make some awesome projects.

Instead of calling addLeds, if you only have one controller you can call :

FastLED[0].init()

before you call show. which will force the controller to fully re-initialize its SPI settings.

(if you have more than one you can use a loop - to call init on all the controllers)

Just checked, works exactly as described.

It’s weird because playFlashRaw1.isPlaying() is able to see that the file is playing and flips to false when the file ends. But the audio volume cuts out the moment FastLED[0].init() is called even though playFlashRaw1.isPlaying() still works.