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

Thread: How to use Audio Shield SPI and off board SPI

  1. #1

    How to use Audio Shield SPI and off board SPI

    FYI
    The SPI for the SD-card on the audio board running at 24MHz is intolerant of long signal lines on its bus. On a project using the Teensy 3.2, audio board and an I/O expander MCP23S08 a breadboard project (and subsequent PWBs) worked great.

    However, when the I/O expander was moved to its proper location about 8 ft away all kinds of ringing, noise and fun ensued. The SD-card and MCP23S08 libraries allow the bus speed to be changed between devices but that wasn't enough. Solutions that would help one device hurt the other. Note, a good oscilloscope with SPI decoding was essential in diagnosing.

    A 74LVC126 tristate output buffer solved the problems. No software changes were required. When the CS line for the audio is pulled down it disconnects the bus from the slower SPI devices and their cable reflections ect.

    Click image for larger version. 

Name:	Screen Shot 2018-12-29 at 12.46.15 PM.png 
Views:	30 
Size:	107.9 KB 
ID:	15451

    I know this isn't the greatest way to handle remote stuff but it seems to work reliably.

  2. #2
    Senior Member
    Join Date
    Nov 2015
    Location
    Cold hollow VT
    Posts
    113
    @Bicycleguy You did the right thing to isolate the long bus from the short bus. However, I don't think it is necessary to tri-state the SCK and MOSI lines to the remote electronics. Only the MISO line should be tri-stated when remote is not in use to eliminate bus contention issues. Buffering the CS lines to the remote electronics can't hurt either.

  3. #3
    @grease_lighting Thanks for the input.
    For some reason the clock was the most sensitive, perhaps the pairs I chose for the ethernet cable used for this and power or other signals. The CS lines are all separate so I didn't try to isolate them, but did look at them with the scope and they seemed ok. But I tried all combinations of the MISO, CLK and MOSI and they all had issues with the audio board no matter if terminated on one side or the other or both. Any 24MHz clock or data would cause all kinds of noise if not isolated from the long bus.

  4. #4
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,021
    for long SPI cabling forget about 24MHz but to help prevent ringing you’d need to put small resisters in series near the source driven lines. You could go further distances as well by decreasing the SPI speed. I’ve driven MCP23S17’s at 5 feet and run them at 2 MHz

Posting Permissions

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