Using the prop shield with optimized SPI devices

Status
Not open for further replies.

MichaelMeissner

Senior Member+
As some of you know, I tend to like neopixels (ws2812b's) and I've been playing with twin 128x128 ST7753 (TFT LCD) or SSD1351 (OLED) displays using the uncanny eyes scripts from Adafruit (https://learn.adafruit.com/animated-electronic-eyes-using-teensy-3-1).

What I would like to do is combine the screens with neopixels, using either of the prop shields (wit/LC) to do the level conversion.

Without using the SPI devices, I would just set pin 7 HIGH just before calling the show function using the standard Adafruit library, and set it LOW after the call.

Originally, I tried using the suggestion in the prop shield description:

When other SPI communication is used, pin 7 must be HIGH to allow LED access and LOW to prevent other SPI chips from interfering with the LEDs. The SPI transactions functions should also be used. You will need to include SPI.h to have access to these SPI functions.

Code:
    // beginTransaction prevents SPI bus conflicts
    SPI.beginTransaction(SPISettings(24000000, MSBFIRST, SPI_MODE0));
    digitalWrite(7, HIGH);  // enable access to LEDs
    FastLED.show();
    digitalWrite(7, LOW);
    SPI.endTransaction();   // allow other libs to use SPI again

TODO: Using 24 vs 12 MHz SPI speed

TODO: recommendation on current through PCB vs dedicated power wires

My code seems to hang if I call SPI.beginTransaction before doing the normal SPI setup. Is there a SPI function that says whether SPI.begin has been called? Or do I need to maintain a state variable in the neopixel library that I've developed to say whether to do the SPI transaction stuff or not.

The uncanny eyes program doesn't use SPI_MODE0, it uses SPI_MODE3. I assume when I call SPI.beginTransaction, do I need to use the same settings as the other SPI devices? Or can I switch modes between the calls? Is the prop shield capable of doing the fast LED driver with SPI modes other than mode0?

Does anybody have a sketch that does some neopixels along with one of these accelerated displays? Would switching from Adafruit_Neopixel to FastLed help?
 
Last edited:
I assume when I call SPI.beginTransaction, do I need to use the same settings as the other SPI devices? Or can I switch modes between the calls?

Hi Michael,
no, you can use different settings for every call of SPI.beginTransaction() - i use this often -you can change every parameter.

Is the prop shield capable of doing the fast LED driver with SPI modes other than mode0?
Well i havn't tested it, but i guess yes, because according to the schematic there are just some "dumb" gates which are not interested in the mode ;)
 
Last edited:
Status
Not open for further replies.
Back
Top