A2DP with I2C doesnt work #1730
-
Problem DescriptionHello, i have one question, i use sigmadsp to control a dsp ADAU1701 with esp32-a1s but i think it doesnt work a2dp and i2c, . could be? because when i use a2dp, the i2c doesnt send nothing.but if i dont use a2dp, the i2c send the information. Device DescriptionAI-Thinker AudioKit, ADAU1701 from womdom Sketch/**|
| SigmaDSP library |
| https://github.com/MCUdude/SigmaDSP |
| |
| 1_Volume1.ino |
| This example fades the volume up and down |
| using a slew volume adjustment slider. |
| See the SigmaStudio project file if you want |
| to learn more, tweak or do modifications. |
|**/
// Include Wire and SigmaDSP library
#include <Wire.h>
#include <SigmaDSP.h>
// Include generated parameter file
#include "SigmaDSP_parameters.h"
#include "AudioTools.h"
#include "AudioLibs/A2DPStream.h" // install https://github.com/pschatzmann/ESP32-A2DP
#include "AudioLibs/AudioBoardStream.h" // install https://github.com/pschatzmann/arduino-audio-driver
// The first parameter is the Wire object we'll be using when communicating wth the DSP
// The second parameter is the DSP i2c address, which is defined in the parameter file
// The third parameter is the sample rate
// An optional fourth parameter is the pin to physically reset the DSP
SigmaDSP dsp(Wire, DSP_I2C_ADDRESS, 48000.00f /*,12*/);
BluetoothA2DPSink a2dp_sink;
AudioBoardStream kit(AudioKitEs8388V1);
// Only needed if an external i2c EEPROM is present + the DSP is in selfboot mode
// The first parameter is the Wire object we'll be using when communicating wth the EEPROM
// The second parameter is the EEPROM i2c address, which is defined in the parameter file
// The third parameter is the EEPROM size in kilobits (kb)
// An optional fourth parameter is the pin to toggle while writing content to EEPROM
//DSPEEPROM ee(Wire, EEPROM_I2C_ADDRESS, 256, LED_BUILTIN);
void read_data_stream(const uint8_t *data, uint32_t length) {
kit.write(data, length);
}
void setup()
{
Serial.begin(9600);
Serial.println(F("SigmaDSP 1_Volume example\n"));
Wire.begin();
dsp.begin();
//ee.begin();
delay(2000);
Serial.println(F("Pinging i2c lines...\n0 -> deveice is present\n2 -> device is not present"));
Serial.print(F("DSP response: "));
Serial.println(dsp.ping());
//Serial.print(F("EEPROM ping: "));
//Serial.println(ee.ping());
// Use this step if no EEPROM is present
Serial.print(F("\nLoading DSP program... "));
loadProgram(dsp);
Serial.println("Done!\n");
auto cfg = kit.defaultConfig(TX_MODE);
cfg.sd_active = false;
kit.begin(cfg);
// register callback
a2dp_sink.set_stream_reader(read_data_stream, false);
a2dp_sink.start("AudioKit");
// Comment out the three code lines above and use this step instead if EEPROM is present
// The last parameter in writeFirmware is the FW version, and prevents the MCU from overwriting on every reboot
//ee.writeFirmware(DSP_eeprom_firmware, sizeof(DSP_eeprom_firmware), 0);
//dsp.reset();
//delay(2000); // Wait for the FW to load from the EEPROM
}
void loop()
{
// Slowly adjust the volume down to -50dB
Serial.println(F("Fading down"));
for(int8_t i = 0; i > -51; i--)
{
dsp.volume_slew(MOD_SWVOL1_ALG0_TARGET_ADDR, i, 12); // (First volume slider address, dB value, optional slew value)
delay(200);
}
// Slowly adjust the volume up to 0dB
Serial.println(F("Fading up"));
for(int8_t i = -50; i < 1; i++)
{
dsp.volume_slew(MOD_SWVOL1_ALG0_TARGET_ADDR, i); // Slew rate is default 12
delay(200);
}
} Other Steps to ReproduceNo response What is your development environmentNo response I have checked existing issues, discussions and online documentation
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This is not a bug in my solftware, so please don't open an issue for it, but use a discussion. I am afraid I don't quite understand your hardware setup and what you try to do. Last but not least: Wire is already used by the AudioBoardStream to set up the ES8388! So please use Wire1 or configure the audio driver used by AudioBoardStream to use a different Wire object. |
Beta Was this translation helpful? Give feedback.
This is not a bug in my solftware, so please don't open an issue for it, but use a discussion.
I am afraid I don't quite understand your hardware setup and what you try to do.
Are you sending an analog output from the aux output of the AudioKit to the ADAU1701 ?
Wouln't you better just use a simple ESP32 and communicate via I2S ?
Your sketch seems to control the volume: but both the BluetoothA2DPSink and the AudioBoardStream already provide some volume control: So I don't see the point.
Last but not least: Wire is already used by the AudioBoardStream to set up the ES8388!
So please use Wire1 or configure the audio driver used by AudioBoardStream to use a different Wire object.