I2C communication between a ESP32 and ESP32 Audiokit does not work #42
-
Hello, I hope you can help me. Errors that accured where for example: The code for the audiokit I use is: #include <Wire.h> #define I2C_SLAVE_ADDR 0x08 // I²C-Adresse des Slave volatile uint8_t sensor = 0; // Zahl von 1 bis 5 AudioBoardStream i2s(AudioKitEs8388V1); void setup() { Wire1.begin(21, 22); auto config = i2s.defaultConfig(TX_MODE); if (!SD_MMC.begin("/sdcard", false)) { void playAudioFile(uint8_t sensorValue) { if (audioFile) { audioFile = SD_MMC.open(filename.c_str()); encoded.begin(); void loop() { if (bytesReceived == 3) {
} else { delay(1000); This is the o for the ESP32 I use: #include <Wire.h> #define I2C_SLAVE_ADDR 0x08 uint8_t sensor = 1; void setup() { void loop() { void requestEvent() { sensor = (sensor % 5) + 1; uint8_t data[3]; Wire.write(data, 3); This is the code for the Auiokit whih works but only with serial monitor output of the values // Master Aktorik #define I2C_SLAVE_ADDR 0x08 volatile uint8_t sensor = 0; void setup() { void loop() { Serial.print("Bytes empfangen: "); if (bytesReceived == 3) {
} else { delay(1000); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
Be careful: for AudioKitEs8388V1 Wire is used with the pins 32 and 33 to communicate with the codec! class PinsAudioKitEs8388v1Class : public DriverPins {
public:
PinsAudioKitEs8388v1Class() {
// sd pins
addSPI(ESP32PinsSD);
// add i2c codec pins: scl, sda, port, frequency
addI2C(PinFunction::CODEC, 32, 33);
// add i2s pins: mclk, bck, ws,data_out, data_in ,(port)
addI2S(PinFunction::CODEC, 0, 27, 25, 26, 35);
// add other pins
addPin(PinFunction::KEY, 36, PinLogic::InputActiveLow, 1);
addPin(PinFunction::KEY, 13, PinLogic::InputActiveLow, 2);
addPin(PinFunction::KEY, 19, PinLogic::InputActiveLow, 3);
addPin(PinFunction::KEY, 23, PinLogic::InputActiveLow, 4);
addPin(PinFunction::KEY, 18, PinLogic::InputActiveLow, 5);
addPin(PinFunction::KEY, 5, PinLogic::InputActiveLow, 6);
addPin(PinFunction::AUXIN_DETECT, 12, PinLogic::InputActiveLow);
addPin(PinFunction::HEADPHONE_DETECT, 39, PinLogic::InputActiveLow);
addPin(PinFunction::PA, 21, PinLogic::Output);
addPin(PinFunction::LED, 22, PinLogic::Output);
}
};
|
Beta Was this translation helpful? Give feedback.
-
Did you try to separate the I2S from the I2C processing in separate tasks ? |
Beta Was this translation helpful? Give feedback.
Be careful: for AudioKitEs8388V1 Wire is used with the pins 32 and 33 to communicate with the codec!
And pins 21 and 22 are used by the PA and LED