In my application, I have an FPGA module who is master of the audio clock.
I am pretty confident that this FPGA module is working fine as we already used it in the same configuration on multiple projects.
The FPGA module generate a TDM bus with 16 channels of 32-bit , it has 5 wires connected to the Jetson Nano 40 pin headers:
- CLK at 22.5792MHz connected to DAP4_SCLK
- FRAME at 44.1KHz connected to DAP4_FS
- DATA Out connected to DAP4_DIN
- DATA In connected to DAP4_DOUT
- Ground to GND pin 6
Typically everything will works perfectly for may be 1 to 3 hours, I can play and record no problem, audio signals looks/sounds good.
But at some point, the audio time slots get shifted, for example: 0 goes 2, 1 goes to 3, 2 goes to 4, … , 14 goes to 0 and 15 goes to 1.
And it will continue to shift randomly typically every so often.
Looks like the Nano Board sometime loose the frequency lock.
The cable between the FPGA board and Jetson Nano is short ~1.5". I checked the signals on both sides with a scope and they look good.
I tried with different configuration: 44.1KHz, 48KHz, 32KHz, same problem.
I tried with different FRAME signals: Frame high for 1 bit, Frame high for 32 bits and FRAME 50% (I2S like), same problem.
I checked the system logs and dmesg but there is no messages when this is happening.
When the time slots are shifted, I can realign them by typing a few times: “alsactl init tegrasndt210ref”
Here is how I configure ALSA:
alsactl init tegrasndt210ref
amixer -c tegrasndt210ref -q sset ‘ADMAIF1 Mux’ I2S4
amixer -c tegrasndt210ref -q sset ‘I2S4 codec frame mode’ dsp-a
amixer -c tegrasndt210ref -q sset ‘I2S4 fsync width’ 256
amixer -c tegrasndt210ref -q sset ‘ADMAIF1 Channels’ 16
amixer -c tegrasndt210ref -q sset ‘I2S4 Channels’ 16
amixer -c tegrasndt210ref -q sset ‘I2S4 Sample Rate’ 44100
amixer -c tegrasndt210ref -q sset ‘I2S4 codec bit format’ 32
amixer -c tegrasndt210ref -q sset ‘I2S4 input bit format’ 32
amixer -c tegrasndt210ref -q sset ‘I2S4 codec master mode’ cbm-cfm
I also attached some logic analyzer screenshots.