when there is no sound, dac outputs 1.7V
tesla-cat opened this issue · comments
when there is no sound from the bluetooth, the dac outputs 1.7V, how can i make it output 0V ?
This is neither a bug, nor I am able to make any sense out of your question. It does not make any sense to ask me to guess what exactly your use case / scenario is that you try to implement.
You don't even specify what and how you measure!
Please open a discussion and provide the following information
- the selected scenario/sketch
- what and how you measure the signal
- what exactly you are trying to do
- what connection and audio state your are referring to
I mean, when i upload the code below to ESP32 board, the DAC output (pin 25) is around 1.7 Volts, instead of 0 Volt
And when I play music via BLUETOOTH, the DAC output has a DC offset of 1.7 V
You can also send the output directly to the internal DAC of the ESP32 by providing the corresponding i2s_config:
#include "BluetoothA2DPSink.h"
BluetoothA2DPSink a2dp_sink;
void setup() {
static const i2s_config_t i2s_config = {
.mode = (i2s_mode_t) (I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN),
.sample_rate = 44100, // corrected by info from bluetooth
.bits_per_sample = (i2s_bits_per_sample_t) 16, /* the DAC module will only take the 8bits from MSB */
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
.communication_format = (i2s_comm_format_t)I2S_COMM_FORMAT_STAND_MSB,
.intr_alloc_flags = 0, // default interrupt priority
.dma_buf_count = 8,
.dma_buf_len = 64,
.use_apll = false
};
a2dp_sink.set_i2s_config(i2s_config);
a2dp_sink.start("MyMusic");
}
void loop() {
}
Using an analog output the signal is oscillating between 0 and 3.1V.
So your measured voltage is about the neutral (0) position.
So I would expect that you will need to switch of the I2S interface to bring it down to 0
By default this is managed by the connection status. But there are many possibilities to enhance the functionality to use the audio status instead.