Skip to content

Commit

Permalink
don't use audio pll on buggy rev0 chips (earlephilhower#40)
Browse files Browse the repository at this point in the history
as ESP32_MP3_Decoder does
  • Loading branch information
h3ndrik authored and earlephilhower committed Jan 26, 2018
1 parent f191605 commit e7c2aba
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/AudioOutputI2S.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ AudioOutputI2S::AudioOutputI2S(int port, bool builtInDAC)
i2sOn = false;
#ifdef ESP32
if (!i2sOn) {
// don't use audio pll on buggy rev0 chips
int use_apll = 0;
esp_chip_info_t out_info;
esp_chip_info(&out_info);
if(out_info.revision > 0) {
use_apll = 1;
}
i2s_config_t i2s_config_dac = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX | (builtInDAC ? I2S_MODE_DAC_BUILT_IN : 0)),
.sample_rate = 44100,
Expand All @@ -41,7 +48,7 @@ AudioOutputI2S::AudioOutputI2S(int port, bool builtInDAC)
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1, // high interrupt priority
.dma_buf_count = 8,
.dma_buf_len = 64, //Interrupt level 1
.use_apll = 1 // Use audio PLL
.use_apll = use_apll // Use audio PLL
};
Serial.printf("+%d %p\n", portNo, &i2s_config_dac);
if (i2s_driver_install((i2s_port_t)portNo, &i2s_config_dac, 0, NULL) != ESP_OK) {
Expand Down

0 comments on commit e7c2aba

Please sign in to comment.