Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Using the prop shield with optimized SPI devices

  1. #1
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,265

    Question Using the prop shield with optimized SPI devices

    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-...ing-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 by MichaelMeissner; 12-06-2016 at 08:51 PM.

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Quote Originally Posted by MichaelMeissner View Post
    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.

    Quote Originally Posted by MichaelMeissner View Post
    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 by Frank B; 12-06-2016 at 09:12 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •