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

Thread: Use Teensy 3.6's SD Card

  1. #1
    Senior Member
    Join Date
    Feb 2017
    Posts
    403

    Use Teensy 3.6's SD Card

    Hi. I'd like to use the Audio library to play .wav files from the Teensy 3.6 SD card rather than the one on the Audio Shield. How do I tell it to use that interface rather than SPI0?

    If there's already an example of doing this, please just point me in that direction.

    Thanks.
    Last edited by gfvalvo; 04-19-2017 at 11:20 PM.

  2. #2
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,497
    Assuming you are using the Audio adaptor with the T3.6 to play the audio, it may be as simple as changing SD.begin() to use BUILTIN_SDCARD in the examples>Audio>WavFilePlayer

  3. #3
    Senior Member
    Join Date
    Feb 2017
    Posts
    403
    I'm not sure. Thinking maybe I have to instantiate a new SPI object since the T3.6's SD card is connected to a different SPI interface in the K66. Also, that SD card looks to be wired for both SD Mode and SPI Mode. Thinking I have to make that selection somewhere.

  4. #4
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,497
    The T3.6 SD does NOT use SPI, but rather 4-bit SDIO by default.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,852
    First, make sure you have the latest Teensyduino. All the audio lib examples which use the SD card were recently updated to document this. Just open File > Examples > Audio > WavFilePlayer or any of the others which use the SD card.

  6. #6
    Senior Member
    Join Date
    Feb 2017
    Posts
    403
    Quote Originally Posted by PaulStoffregen View Post
    First, make sure you have the latest Teensyduino. All the audio lib examples which use the SD card were recently updated to document this. Just open File > Examples > Audio > WavFilePlayer or any of the others which use the SD card.
    Can't get much easier than that. Thanks Paul.

  7. #7
    Senior Member
    Join Date
    Feb 2017
    Posts
    403
    Oops, spoke to soon. Updated from Teensyduino 1.35 to 1.36 and something unrelated broke. Verify operation can't find the function 'pow10f' when target board is a Teensy. Simple example:
    Code:
    void setup() {
      Serial.begin(115200);
      delay(2000);
    
      float a = pow10f(2.0);
      Serial.println(a);
    }
    void loop() {
    }
    Code:
    Arduino: 1.6.12 (Windows 7), TD: 1.36, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Faster, US English"
    
    pow10: In function 'void setup()':
    pow10:5: error: 'pow10f' was not declared in this scope
       float a = pow10f(2.0);
    
                           ^
    
    'pow10f' was not declared in this scope
    
    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.
    Compiles fine for Adafruit M0 and ESP8266 Huzzah boards.

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,852
    Yikes, that's a problem!

    For a quick fix, put this in your code:

    Code:
    extern "C" float pow10f(float);
    I've put this on the high priority list for 1.37.

  9. #9
    Junior Member Chief's Avatar
    Join Date
    May 2017
    Posts
    3
    Sorry to piggyback, but the problem calling pow10f is also affecting the OctoWS2811 SpectrumAnalyzer example code:

    Code:
       logLevel = pow10f(n * -1.0 * (dynamicRange / 20.0));
    returns this error:
    Code:
    SpectrumAnalyzer:135: error: 'pow10f' was not declared in this scope
         logLevel = pow10f(n * -1.0 * (dynamicRange / 20.0));
    
    'pow10f' was not declared in this scope
    Teensy 3.2, Arduino 1.8.2, Teensyduino 1.36, MacOS Sierra 10.12.4



    Chief

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,852
    I've added a fix for these. It'll be in version 1.37.

    https://github.com/PaulStoffregen/co...fadd0b6129046f

Posting Permissions

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