Audio library cannot find sd card

Status
Not open for further replies.

yoda1976

Member
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:
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
 
I cant install teensyduino anymore

YVmD3MV.png

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
 
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.
 
Status
Not open for further replies.
Back
Top