Teensy 4.1 + APA102: which pins support Hardware SPI?

Status
Not open for further replies.

spolsky

Member
Easy question, I think ...

Which pins of the Teensy 4.1 can I use to drive an APA102c LED strip (with data + clock) to take advantage of Hardware SPI support from FastLED?

The FastLED documentation here doesn't cover Teensy versions later than 3.1. But in general I am staring at the pinout card for Teensy 4.1 and it's just unclear to me which pins have Hardware SPI support.

THANKS!
 
ah oh... maybe I solved my own problem? Apparently there's a color code to the pinout card, but the meaning of the colors is not printed on the card any more! By putting the Teensy 4.1 pinout card next to the Teensy 3.2 pinout card it looks like lime green means SPI.

So my assumption is that I can use MOSI + SCK (11 + 13) and maybe also even MOSI1 + SCK1 (26+27) for SPI for my LED strips.
 
Your assumption is correct: MOSI + SCK (11 + 13) or MOSI1 + SCK1 (26+27).
Both work, I just checked on a Teensy 4.1.
BTW, formally you should use a 3V3>5V levelshifter for the clock & data lines but it seems to work without apparently.
The datasheet states that the "Input High Voltage" must be minimal "0.7VDD" which is 3.5V. Teensy 4.1 output HIGH is 3.3V max.

Paul
 

Attachments

  • APA102 LED.pdf
    275.5 KB · Views: 145
Thanks!

I will submit an issue to the maintainer of that fastLED documentation.

With an APA102c directly connected, it does seem to work ok even at 3.3V, but I agree that a level shifter is a good idea!
 
Should this code work?

Code:
#define NUM_LEDS 60
#include <FastLED.h>

struct CRGB *leds;

void setup()
{                
  FastLED.addLeds<APA102,13,11,BGR>(leds,NUM_LEDS);
}
void loop()   
{
  leds[0] = CRGB(255, 0, 0);
  leds[4] = CRGB(20, 255, 255);
  leds[6] = CRGB(20, 255, 255);
  FastLED.show();
  delay(200);
}

Connect ground and voltage to an external 5V Adapter …

no success, plz help.

Thx,

Tom
 
Tom, you would need to allocate an array for the leds (you only allocated a pointer).

Also - did you connect teensy ground to power supply ground?
 
Status
Not open for further replies.
Back
Top