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

Thread: Audio library cannot find sd card

  1. #1
    Junior Member
    Join Date
    Oct 2019
    Posts
    14

    Audio library cannot find sd card

    Hello,

    I created a 44000hz 16 bit stereo wav file with audacity , then I put it on a sd card (FAT32 - windows 7)
    I put the sd card in a teensy 3.6

    trying the below code, the teensy is not reacheable anymore ...after a while, a message keeps repeating in the IDE

    Code:
    Error while setting serial port parameters: 38,400 N 8 1
    unless I comment the "SD.begin..." line

    really weird, since it's taken from the official audio library example code, and the teensy is bare (not inside a system nor anything)

    any help appreciated

    thanks

    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    AudioPlaySdWav           playWav1;
    AudioOutputAnalog       audioOutput;
    AudioConnection          patchCord1(playWav1, 0, audioOutput, 0);
    AudioConnection          patchCord2(playWav1, 1, audioOutput, 1);
    
    // Use these with the Teensy 3.5 & 3.6 SD card
    #define SDCARD_CS_PIN    BUILTIN_SDCARD
    #define SDCARD_MOSI_PIN  11  // not actually used
    #define SDCARD_SCK_PIN   13  // not actually used
    
    void setup() {
      Serial.begin(38400);
    
      // Audio connections require memory to work.  For more
      // detailed information, see the MemoryAndCpuUsage example
      AudioMemory(8);
    
      SPI.setMOSI(SDCARD_MOSI_PIN);
      SPI.setSCK(SDCARD_SCK_PIN);
      Serial.println("SD.begin...");
      if (!(SD.begin(SDCARD_CS_PIN))) {
        
        // stop here, but print a message repetitively
        while (1) {
          Serial.println("Unable to access the SD card");
          delay(500);
        }
      }
    }
    
    void playFile(const char *filename)
    {
      Serial.print("Playing file: ");
      Serial.println(filename);
    
      playWav1.play(filename);
    
      delay(5);
    
      while (playWav1.isPlaying()) {
      }
    }
    
    
    void loop() {
      playFile("MYFILE.WAV");  // filenames are always uppercase 8.3 format
      delay(2000);
    }
    Last edited by yoda1976; 10-06-2019 at 10:29 PM.

  2. #2
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,236
    what version of IDE and teensyduino are you using? there was a problem AudioPlaySdWav a few months ago. you may need to get the latest IDE/Teensyduino

  3. #3
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    1.8.9, I'll try 1.8.10
    hope it dont breaks anything else :-)

  4. #4
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    arf f#@k , now I get "Audio.h: No such file or directory"

    I just hate the arduino IDE

  5. #5
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,236
    Quote Originally Posted by yoda1976 View Post
    1.8.9, I'll try 1.8.10
    hope it dont breaks anything else :-)
    the SdWav problem was with Teensyduino -- what version of that are you running? (it's what you install from Teensy after you have installed new version of Arduino IDE)

    get the latest 1.48-beta3 https://forum.pjrc.com/threads/57894...no-1-48-Beta-3

  6. #6
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    I cant install teensyduino anymore

    Click image for larger version. 

Name:	YVmD3MV.png 
Views:	4 
Size:	48.6 KB 
ID:	17828

    I cant select the arduino install folder , the next button stays grayed out

    checking the ? button I see 1.8.10 is not supported...for fuck sake

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,780
    Get the latest 1.48-beta3.

    In that screenshot, you have 1.47 which is older than the latest Arduino 1.8.10.

  8. #8
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    No I recompile and I get this

    Click image for larger version. 

Name:	4dkMhi2.jpg 
Views:	10 
Size:	65.0 KB 
ID:	17829

    seriously ???

  9. #9
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    oh no way ot a beta , dude, I am not playing around here come on

    f the sd card, I'll do without it

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,780
    In your screenshot on msg #8, looks like Teensy 3.2 is select. That's probably why you're getting the error the SDCARD_CS_PIN is undefined. Teensy 3.2 doesn't have a built in SD card socket.

    I know compile errors are frustrating. I also hope you can understand why this error happens when you have Teensy 3.2 selected?

    oh no way ot a beta , dude, I am not playing around here come on
    I'll admit, we are late for a stable 1.48 release. Since beta3 is looking good, I'm probably going to release it later today.

    Normally the plan is to release a beta within 24 hours of each Arduino release. Arduino 1.8.10 was released Sept 13. We did get 1.48-beta1 published about 24 hours later. Normally the plan looks like 2 to 3 weeks of beta testing before we release a stable version. That also allows time to see if Arduino has any serious bugs that prompt another quick release (as happened with 1.8.6).

    So please try to keep a little perspective here. It's been 3 weeks and 2 days since Arduino released 1.8.10. A stable non-beta release just isn't practical immediately when Arduino publishes a new version. Normally we get it within 2-3 weeks, and this time we're going to be only a few days beyond that time frame.

Posting Permissions

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