Problem with SD Card #575
-
Hey there, I'm trying to build an MP3 Player with an ESP32-A1s and ESP32-audioI2S. 09:30:05.801 -> .............Connected The SD Card is FAT32, 32GB and I can read and write the directories with the SD test Code. Here's the code, can anybody help, to figure out my problem? Is there a Problem with the Files or the SD Card or anything else? Thank you // found this sketch on https://www.mikrocontroller.net/topic/474383 #include "Arduino.h" // SPI GPIOs // I2S GPIOs, the names refer on ES8388, AS1 Audio Kit V2.2 3378 // I2C GPIOs // buttons // amplifier enable //Switch S1: 1-OFF, 2-ON, 3-ON, 4-OFF, 5-OFF String ssid = "x"; int volume = 80; // 0...100 ES8388 es; //##################################################################### void setup() if (!SD.begin(CS, spi, 1000000)) { if(cardType == CARD_NONE){ WiFi.mode(WIFI_STA); while (WiFi.status() != WL_CONNECTED) Serial.printf_P(PSTR("Connected\r\nRSSI: "));
// ac.DumpRegisters();
//audio.connecttoSD("/Olsen-Banden.mp3"); } void loop() // optional |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
please try with these GPIOs, S2 and S3 must be on #include "Arduino.h"
#include "WiFi.h"
#include "SPI.h"
#include "SD.h"
#include "FS.h"
#include "Wire.h"
#include "ES8388.h" // https://github.com/maditnerd/es8388
#include "Audio.h" //https://github.com/schreibfaul1/ESP32-audioI2S
// SPI GPIOs
#define CS 13
#define MOSI 15
#define MISO 2
#define SCK 14
// I2S GPIOs, the names refer on ES8388, AS1 Audio Kit V2.2 3378
#define I2S_SDOUT 26
#define I2S_BCLK 27
#define I2S_LRCK 25
#define I2S_MCLK 0
// I2C GPIOs
#define IIC_CLK 32
#define IIC_DATA 33
// buttons
// #define BUTTON_2_PIN 13 // shared mit SPI_CS
#define BUTTON_3_PIN 19
#define BUTTON_4_PIN 23
#define BUTTON_5_PIN 18 // Stop
#define BUTTON_6_PIN 5 // Play
// amplifier enable
#define GPIO_PA_EN 21
//Switch S1: 1-OFF, 2-ON, 3-ON, 4-OFF, 5-OFF
int volume = 80; // 0...100
ES8388 es;
Audio audio;
//#####################################################################
void setup()
{
Serial.begin(115200);
SPI.begin(SCK, MISO, MOSI);
SPI.setFrequency(1000000);
SD.begin(CS);
Serial.printf_P(PSTR("Connected\r\nRSSI: "));
Serial.print(WiFi.RSSI());
Serial.print(" IP: ");
Serial.println(WiFi.localIP());
Serial.printf("Connect to DAC codec... ");
while (not es.begin(IIC_DATA, IIC_CLK))
{
Serial.printf("Failed!\n");
delay(1000);
}
Serial.printf("OK\n");
es.volume(ES8388::ES_MAIN, volume);
es.volume(ES8388::ES_OUT1, volume);
es.volume(ES8388::ES_OUT2, volume);
es.mute(ES8388::ES_OUT1, false);
es.mute(ES8388::ES_OUT2, false);
es.mute(ES8388::ES_MAIN, false);
// ac.DumpRegisters();
// Enable amplifier
pinMode(GPIO_PA_EN, OUTPUT);
digitalWrite(GPIO_PA_EN, HIGH);
// set I2S_MasterClock
// audio.i2s_mclk_pin_select(I2S_MCLK);
audio.setPinout(I2S_BCLK, I2S_LRCK, I2S_SDOUT);
audio.i2s_mclk_pin_select(I2S_MCLK);
audio.setVolume(21); // 0...21
//audio.connecttoSD("1.mp3");
audio.connecttoFS(SD, "320k_test.mp3");
}
//-----------------------------------------------------------------------
void loop()
{
audio.loop();
}
// optional
void audio_info(const char *info){
Serial.print("info "); Serial.println(info);
}
void audio_id3data(const char *info){ //id3 metadata
Serial.print("id3data ");Serial.println(info);
}
void audio_eof_mp3(const char *info){ //end of file
Serial.print("eof_mp3 ");Serial.println(info);
}
void audio_showstation(const char *info){
Serial.print("station ");Serial.println(info);
}
void audio_showstreamtitle(const char *info){
Serial.print("streamtitle ");Serial.println(info);
}
void audio_bitrate(const char *info){
Serial.print("bitrate ");Serial.println(info);
}
void audio_commercial(const char *info){ //duration in sec
Serial.print("commercial ");Serial.println(info);
}
void audio_icyurl(const char *info){ //homepage
Serial.print("icyurl ");Serial.println(info);
}
void audio_lasthost(const char *info){ //stream URL played
Serial.print("lasthost ");Serial.println(info);
}
void audio_eof_speech(const char *info){
Serial.print("eof_speech ");Serial.println(info);
} |
Beta Was this translation helpful? Give feedback.
please try with these GPIOs, S2 and S3 must be on