
Originally Posted by
Zed
could you please post your code?
how did you set up the SPI control legs? because the example in adafruit is for uno and the teensy has other SPI legs:
#define RESET 17 // VS1053 reset pin (output)
#define CS 10 // VS1053 chip select pin (output)
#define DCS 16 // VS1053 Data/command select pin (output)
#define CARDCS A0 // Card chip select pin
#define DREQ A1 // VS1053 Data request, ideally an Interrupt pin
let me know how that turned out for you.
HI,
Thank you for your fast reply!
I measured the SPI-Clock @ 8 MHz on the teensy 3.1, which might be to high since the max SPI-Clock of the VS1053 is listed @ 5 MHz. Nevertheless, even changing the SPI_CLOCK_DIV in the adafruit lib didn't change much.
To answer your questions:
Pin-Setup on Teensy 3.1:
VS1053-AdafruitBreakout ==> Teensy 3.1
CLK ==> 13
MISO ==> 12
MOSI ==> 11
DREQ ==> 5
CS ==> 20
Reset ==>23
DCS(XDCS) ==> 22
CARDSCS(SDCS) ==> 21
Sourcecode:
I didn't modify much in the end starting from the Adafruit exemple code...
Code:
/***************************************************
This is an example for the Adafruit VS1053 Codec Breakout
Designed specifically to work with the Adafruit VS1053 Codec Breakout
----> https://www.adafruit.com/products/1381
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>
#define CORE_TEENSY 1
//SPI.setClockDivider(SPI_CLOCK_DIV2);
#define CLK 13 // SPI Clock, shared with SD card
#define MISO 12 // Input data, from VS1053/SD card
#define MOSI 11 // Output data, to VS1053/SD card
#define RESET 23 // VS1053 reset pin (output)
#define CS 20 // VS1053 chip select pin (output)
#define DCS 22 // VS1053 Data/command select pin (output)
#define DREQ 5 // VS1053 Data request pin (into Arduino)
#define CARDCS 21 // Card chip select pin
Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer(RESET, CS, DCS, DREQ, CARDCS);
void setup() {
Serial.begin(9600);
// pinMode(RESET, OUTPUT);
// digitalWrite(RESET, HIGH);
Serial.println("Adafruit VS1053 Simple Test");
if (! musicPlayer.begin()) { // initialise the music player
Serial.println(F("Couldn't find VS1053, do you have the right pins defined?"));
while (1);
}
Serial.println(F("VS1053 found"));
SD.begin(CARDCS); // initialise the SD card
// Set volume for left, right channels. lower numbers == louder volume!
musicPlayer.setVolume(20,20);
// Timer interrupts are not suggested, better to use DREQ interrupt!
//musicPlayer.useInterrupt(VS1053_FILEPLAYER_TIMER0_INT); // timer int
// If DREQ is on an interrupt pin (on uno, #2 or #3) we can do background
// audio playing
musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT); // DREQ int
// Play one file, don't return until complete
Serial.println(F("Playing track 001"));
musicPlayer.playFullFile("track001.mp3");
// Play another file in the background, REQUIRES interrupts!
Serial.println(F("Playing track 002"));
musicPlayer.startPlayingFile("track002.mp3");
}
void loop() {
// File is playing in the background
if (musicPlayer.stopped()) {
Serial.println("Done playing music");
while (1);
}
if (Serial.available()) {
char c = Serial.read();
// if we get an 's' on the serial console, stop!
if (c == 's') {
musicPlayer.stopPlaying();
}
// if we get an 'p' on the serial console, pause/unpause!
if (c == 'p') {
if (! musicPlayer.paused()) {
Serial.println("Paused");
musicPlayer.pausePlaying(true);
} else {
Serial.println("Resumed");
musicPlayer.pausePlaying(false);
}
}
}
delay(100);
}
Thank you a lot for your time!