Audio signal issue headphones, microphone and headset

We are working with a custom board and a Colibri iMX6DL.
For analog audio we use the Headphone_L and R outputs and the Mic_in input.
We multiplex the audio output of the Colibri to be able to have audio either in a speaker or in headphones. Additionally for the microphone input we have the option of an internal microphone or we can also use the headset microphone, this signal is also multiplexed.
To choose between: “output by the speaker - input by internal microphone” or “output by headphones – input by external microphone” we use Dual 2:1 MUX/SPDT Audio Switch and we have two options (the selector circuits work with logic inputs), one is through the tipswitch of the female connector of 3.5mm and another through a GPIO.
By default the speaker is the audio output preferred, and the control is made by tipswitch
When we turn on the board the speaker sounds good, after when we connect the headphones sometimes sound and sometimes not, when we disconect the headphones the speaker doesn’t work.
Trying to see where the signal is lost we realized that it is at the output of the colibri module, apparently somehow it is resetting the codec.
Do you know why this may be happening?

Audio I/O is realised using a SGTL5000 audio codec. There is no obvious way to reset this codec from outside. Therefore I expect it to be a side effect of your circuit.
Could you please share your schematics of the audio connections - Especially the circuit on the following Colibri pins are of iterest:

  • MIC_IN
  • +V3.3_AUDIO

We detected an issue with the MIC input of the SGTL5000 Audio Codec, which is routed through a series capacitor to the Colibri’s MIC_IN pin.

Depending on the external audio circuit, switching the microphone (e.g. by unplugging/replugging it) might cause small current spikes on the MIC signal, which can be sufficient to trigger an on-chip reset of the SGTL5000. A reboot recovers from this situation.

On our latest modules (Colibri iMX6 V1.1 and later) we prevented this problem by inserting a 100Ω series resistor into the MIC_IN signal.