Hi all,
I'm building a project on ESP32 called GadgetBuddy. It uses several I2C devices: an LCD (I2C), RTC, Compass, and a TEA5767 FM radio. I’m using custom pins for each I2C device and a manager class to set up everything.
Relevant code snippets:
GadgetBuddyManager.cpp:
void GadgetBuddyManager::setup() {
// 1. Setup radio FIRST on standard I2C
// mRadio.setup(); // uncomment when using hardware
// 2. Setup non-I2C components
mButtons.setup();
mTempHumidSensor.setup();
// 3. Setup LCD (redirects Wire to GPIO 25/26)
mLcdScreen.setup();
// 4. Setup other I2C devices (use existing Wire setup)
mCompass.setup(); // uncomment when using hardware
mRtcClock.setup();
}
Radio.cpp:
#include "Radio.h"
#include <Arduino.h>
#include <radio.h>
#include "data&states/PinDeclarationsConstants.h"
const char* RADIO_READ_ERROR_MSG = "Radio Read Error!";
#define FIX_BAND RADIO_BAND_FM
#define FIX_STATION 9810 // 98.10 MHz
Radio::Radio() : mHasError(false) {}
void Radio::setup() {
mRadio.init();
mRadio.setFrequency(FIX_STATION);
mRadio.setMono(true);
mHasError = false;
}
void Radio::loop() {}
const char* Radio::getStationName() const {
return "Classical 98.1";
}
const char* Radio::getErrorMessage() {
if(!hasError()) {
return nullptr;
}
return RADIO_READ_ERROR_MSG;
}
Problem:
When the TEA5767 is the only device on the I2C bus, it works and I get audio output.
However, if I connect other I2C devices (like an LCD, RTC, or Compass) to the same bus, the radio stops working or becomes unreliable. Removing the other devices makes the radio work again.
What I’ve checked:
Wire.begin()is called in my main setup before any I2C devices.- The TEA5767 is on the default I2C bus (SDA/SCL).
- The amplifier and speaker work with other audio sources.
- The antenna is connected.
- The radio works when it’s the only I2C device.
Questions:
- Is this a known issue with the TEA5767 and multiple I2C devices?
- Is there a workaround or best practice for using TEA5767 with other I2C peripherals on ESP32?
- Do I need to use a separate I2C bus for the radio?
- Any tips for troubleshooting or integrating TEA5767 in multi-I2C setups?
Any advice or suggestions would be greatly appreciated!
Thanks