Fix Si4684 I2S audio: PIN_CONFIG_ENABLE conflict + ADAU1701 BCLK polarity
Two independent bugs silenced the digital audio path from Si4684 into the ADAU1701 even after the FM/DAB tune fix produced a real RF lock: 1. Si4684Driver::configureAfterBoot() wrote PIN_CONFIG_ENABLE (0x0800) as 0x0003, enabling both I2SOUTEN and DACOUTEN. AN649: "only I2SOUTEN or DACOUTEN can be enabled at a time. If both enabled, only analog audio output is enabled" — the chip silently fell back to its unused analog DAC output on every boot. Fixed to 0x8002 (I2SOUTEN + INTBOUTEN), matching the value hitech95/si468x_dab_receiver's working ALSA codec driver uses (SI468X_PROP_I2S_ENABLED); I2SOUTEN alone (0x0002) was not sufficient on this hardware. Also fixed AUDIO_OUTPUT_CONFIG (0x0302), which was being written with a stray I2S-enable bit that property does not have (its only real field is bit0 MONO). 2. Even with the chip correctly outputting I2S, the ADAU1701 received only static. Traced with SIGMA_WRITE_REGISTER_BLOCK live overrides of SerialInputRegister (0x081F, baked into the compiled SigmaStudio export at ILP=0/IBP=0): IBP=1 (input data clocked on the opposite BCLK edge) produced real, recognizable music instead of static on a locked, strong FM signal — first confirmed end-to-end audio in this project's history. ILP=1 made it worse and was reverted; IBP=1 kept as a runtime override in Adau1701Driver::boot(). Remaining noise on top of the music is attributed to antenna quality (RSSI/SNR fluctuated significantly between retunes of the same station on the current improvised antenna) — not yet confirmed with a proper antenna. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0178rASQ6ZETPMUamvpoR2KR
This commit is contained in:
@@ -158,6 +158,21 @@ namespace adau1701
|
||||
return replay;
|
||||
}
|
||||
|
||||
// SerialInputRegister (0x081F) override: bit3 IBP=1, matching the
|
||||
// BCLK edge the Si4684's I2S output actually changes data on
|
||||
// (compiled DSP program default is 0x00 = IBP=0, which produced
|
||||
// pure static on a strong locked signal). ILP=1 was also tried
|
||||
// (0x18) and made it worse (pure white noise again) — IBP alone
|
||||
// (0x08) is the correct override, confirmed live: real, recognizable
|
||||
// music instead of static/noise on a locked FM station.
|
||||
{
|
||||
const unsigned char deviceAddr =
|
||||
static_cast<unsigned char>(pins_.i2cAddr7 << 1);
|
||||
ADI_REG_TYPE serialInFix = 0x08U;
|
||||
SIGMA_WRITE_REGISTER_BLOCK(deviceAddr, 0x081FU, 1U,
|
||||
&serialInFix);
|
||||
}
|
||||
|
||||
booted_ = true;
|
||||
ESP_LOGI(kTag, "SigmaStudio program loaded");
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user