I'm trying to enable the sidetone feature for the DA7218 audio codec. Both microphone and speaker work fine. However the sidetone doesn't work.
I'm using the DA14195DEVKTD with SDK v.1.6.2.
#include #include static void EnableSidetone(void) { uint16_t reg; writeCodecReg(SIDETONE_IN_SELECT_REG_adr, SIDE_TONE_SELCET_ADC_2L); // Use anlog mic on ADC2 as a source reg = readCodecReg(DROUTING_ST_OUTFILT_1L_REG_adr); // Enable sidetone for left channel reg |= (1 << 2); writeCodecReg(DROUTING_ST_OUTFILT_1L_REG_adr, reg); reg = readCodecReg(DROUTING_ST_OUTFILT_1R_REG_adr); // Enabled sidetone for right channel reg |= (1 << 2); writeCodecReg(DROUTING_ST_OUTFILT_1R_REG_adr, reg); writeCodecReg(SIDETONE_GAIN_REG_adr, 0x1c); // Set sidetone gain to 0 dB reg = SIDETONE_CTRL_SIDETONE_FILTER_EN; writeCodecReg(SIDETONE_CTRL_REG_adr, reg); // sidetone_filter_en=1, sidetone_mute_en=0 }
The coefficients of the sidetone biquad filter are left at the reset values.
Device:
Hello maxim,
Sorry for the slow reponse, I will look into this for you.
What is the final application?
Kind regards,
Elliott Dexter
Hello Elliott,
I've already found a solution. The problem was with the biquad filter. The sidetone works fine after loading coefficients (1.0 for a00, a10, a20, and 0.0 for others, with proper scaling).
Thank you for yor response.