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

Thread: Audio Shield SPI Sharability Question

  1. #1
    Junior Member lemmings's Avatar
    Join Date
    Apr 2021
    Location
    Vancouver, Canada
    Posts
    12

    Audio Shield SPI Sharability Question

    Hi there, just a quick question here about sharing the SPI pins that are used for the Audio Shield. I would like to use those pins for a small OLED screen (SSD1322) as well. The specs for the Audio Shield say these pins are shareable, are there any limitations there? The OLED screen will not be running any video or complicated animations, just a menu, but the teensy will be running a teensy synthesizer. I haven't used SPI before, so I'm just trying to avoid running into future problems after I have a pcb for my project printed. Thanks everyone!

  2. #2
    Junior Member lemmings's Avatar
    Join Date
    Apr 2021
    Location
    Vancouver, Canada
    Posts
    12
    Ahh, excuse me, I just realized the SPI for the Audio board is only for accessing the SD Card reader, which I am using too, but I imagine there won't be an issue here.

  3. #3
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,144
    SPI is a common bus that can have multiple devices on - each gets a unique CS or chip select pin. If the hardware is built right it won't interfere with other devices when its CS is not selected.

    Paul has a post on TriState that IIRC is linked on PJRC.COM in some SPI related place 'how to properly do SPI'.

    Audio card has SPI for FLASH and SD card when used.

    If using a T_3.6, T_3.5 or T_4.1 ( or wiring the SD card under the T_4.0 ) they use a unique set of SDIO pins that give faster 4 bit SPI SD card access and do not use any of the SPI pins.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,251
    If you do use a SD card, it's important for every library accessing SPI to use the beginTransaction() and endTransaction() functions if the audio library is also reading files from the SD card. Today most libraries do use these functions. But if you have an old library from before those function were part of Arduino's API, or if you write your own, not using those functions will cause problems. They are essential for the SPI library to manage access between different software uses of the bus.

  5. #5
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,144
    Here is that indicated info on :: Better SPI Bus Design in 3 Steps

    Where Step 1 and 2 are hardware and the transactions Paul indicates in p#4:: Step 3: USB SPI Transactions in Software

    pjrc.com/better-spi-bus-design-in-3-steps/

  6. #6
    Junior Member lemmings's Avatar
    Join Date
    Apr 2021
    Location
    Vancouver, Canada
    Posts
    12
    Ah thank you very much for this info! Really appreciate it. I'll be sure to follow this procedure as well as the guidelines laid out on the link provided.

  7. #7
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,058
    And one other thing to remember. If you are using Teensy 3.1, 3.2, 3.5, or 3.6, the Audio Shield and library remap two of the SPI pins:
    • MISO: Normally pin 11, now pin 7;
    • SCLK: Normally pin 13, now pin 14.


    The revision D shield for the Teensy 4.0 and 4.1 do not do this remapping (i.e. MISO is 11 and SCLK is 13).

    Both pins 6 (flash memory) and 10 (SD-card) are used as the audio shield's SPI devices.

Posting Permissions

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