-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
External DAC Error #484
Comments
Hi, . In case you don't get sound output, I can give you some hints:
I hope this helps you a bit to find the problem. |
Take a look to my issue, it could help for pinout : Start with the simplest example. And take a look to my repo to have an implementation of ESP8266audio which can be configured on the web interface : |
@schmurtzm @softhack007 thanks a lot My I2s Dac has a jack for headphones already, so I think it has amplifier built in. Everything works fine for me with an internal DAC. I also tried this output configuration: #ifdef ESP32
Serial.println(F("Using I2S output on ESP32 : please connect your DAC to pins : "));
Serial.println(F("LCK(LRC) -> GPIO25 \r\n BCK(BCLK) -> GPIO26 \r\n I2So(DIN) -> GPIO22"));
#else // we are on ESP8266
Serial.println(F("Using I2S output on ESP8266 : please connect your DAC to pins : "));
Serial.println(F("LCK(LRC) -> GPIO2 (D4) \r\n BCK(BCLK) -> GPIO15 (D8) \r\n I2So(DIN) -> GPIO3 (RX)"));
#endif // end of #ifdef ESP32 It does not also work |
You should probably put it to GND. |
Thanks everybody who helped. I've commented all display logic temporarily from my source. #include <SPIFFS.h>
#include <HTTPClient.h>
#include <Arduino.h>
#include <AudioFileSourceSD.h>
#include <AudioFileSourceID3.h>
#include <AudioOutputSPDIF.h>
#include <AudioGeneratorMP3.h>
#include <AudioOutputI2SNoDAC.h>
#include <AudioOutputI2S.h>
#include <SD.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
#define SPI_SPEED SD_SCK_MHZ(40)
#define SPDIF_OUT_PIN 27
File dir;
AudioFileSourceID3 *id3;
AudioFileSourceSD *source = NULL;
AudioOutputSPDIF *output = NULL;
AudioGeneratorMP3 *decoder = NULL;
AudioOutputI2S *out;
void MDCallback(void *cbData, const char *type, bool isUnicode, const char *string)
{
(void)cbData;
Serial.printf("ID3 callback for: %s = '", type);
if (isUnicode) {
string += 2;
}
while (*string) {
char a = *(string++);
if (isUnicode) {
string++;
}
Serial.printf("%c", a);
}
Serial.printf("'\n");
Serial.flush();
}
class PlayOrder{
public:
String list[100];
int num=-1;
void addToList(String v){
num++;
list[num]=v;
}
String prev(){
if(num>0)
num--;
String ret = list[num];
return ret;
}
void showOrderSerial(){
Serial.println("");
Serial.println("Play order");
for(int i=0; i<=num; i++){
Serial.print(i+1);
Serial.print(". ");
Serial.println(list[i]);
}
Serial.println("");
}
};
class ButtonsState{
public:
int next;
int prev;
};
class Display{
public:
void showName(String name){
// display.clearDisplay();
// display.setTextSize(1);
// display.setTextColor(WHITE);
// display.setCursor(10, 20);
// display.println(name);
// display.display();
}
};
ButtonsState buttons;
PlayOrder po;
Display dis;
void checkInput(){
if(digitalRead(14)==0)
buttons.next+=1;
else buttons.next=0;
if(digitalRead(12)==0)
buttons.prev += 1;
else buttons.prev=0;
}
void setup() {
pinMode(14, INPUT_PULLUP);
pinMode(12, INPUT_PULLUP);
Serial.begin(115200);
Serial.println();
delay(1000);
// if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
// Serial.println(F("SSD1306 allocation failed"));
// }
// display.clearDisplay();
// display.setTextSize(1);
// display.setTextColor(WHITE);
// display.setCursor(0, 10);
// // Display static text
// display.println("Starting...");
// display.display();
audioLogger = &Serial;
source = new AudioFileSourceSD();
id3 = new AudioFileSourceID3(source);
id3->RegisterMetadataCB(MDCallback, (void*)"ID3TAG");
out = new AudioOutputI2S();//uncomment for internal
decoder = new AudioGeneratorMP3();
// NOTE: SD.begin(...) should be called AFTER AudioOutputSPDIF()
// to takover the the SPI pins if they share some with I2S
// (i.e. D8 on Wemos D1 mini is both I2S BCK and SPI SS)
#if defined(ESP8266)
SD.begin(SS, SPI_SPEED);
#else
SD.begin( );
#endif
dir = SD.open("/");
}
void loop() {
checkInput();
if ((decoder) && (decoder->isRunning()) && buttons.next!=1 && buttons.prev!=1) {
if (!decoder->loop()) decoder->stop();
} else {
if(buttons.prev==1){
//switch to next track
File file = SD.open(po.prev().c_str());
if (file) {
Serial.println("Playing "+String(file.name()));
if (String(file.name()).endsWith(".mp3")) {
source->close();
if (source->open(file.name())) {
dis.showName(file.name());
po.addToList(file.name());
po.showOrderSerial();
Serial.printf_P(PSTR("Playing '%s' from SD card...\n"), file.name());
decoder->begin(id3, out);
} else {
Serial.printf_P(PSTR("Error opening '%s'\n"), file.name());
}
}
} else {
Serial.println(F("Playback form SD card done\n"));
delay(1000);
}
}
else{
//switch to next track
File file = dir.openNextFile();
if (file) {
Serial.println("Playing "+String(file.name()));
if (String(file.name()).endsWith(".mp3")) {
source->close();
if (source->open(file.name())) {
dis.showName(file.name());
po.addToList(file.name());
po.showOrderSerial();
Serial.printf_P(PSTR("Playing '%s' from SD card...\n"), file.name());
decoder->begin(id3, out);
} else {
Serial.printf_P(PSTR("Error opening '%s'\n"), file.name());
}
}
} else {
Serial.println(F("Playback form SD card done\n"));
delay(1000);
}
}
}
}``` |
I made a screenshot of data paassed to dac, looks like something correct. What else can I do wrong?https://media.discordapp.net/attachments/804717131249221672/938161284195688509/unknown.png?width=1200&height=409 |
Hello!
![image](https://user-images.githubusercontent.com/38169798/149383616-f62df76c-85a1-4eb7-a4f1-dd11bb9f3c8d.png)
I've bought this DAC: https://aliexpress.ru/item/32807703240.html?sku_id=64387073698
But I can't get in working
My pinout:
VIN->3v3
GND->GND
LCK->D2
DIN->RX0 (I don't have RX without number, my rx0 is GPIO 3)
BCK-> D15 (
SCK->GND
I have an ESP-32 module with exactly the same pinout as shown here
Here's my code
Could you please suggest me what am I doing wrong?
The text was updated successfully, but these errors were encountered: