I2S Timing Issues

Status
Not open for further replies.

jkoffman

Well-known member
Hi all,

I'm working on a project and seeing a weird intermittent problem. I'm trying to learn more about why it's happening so I can figure out a solution or at least a work around.

This is a project with two Teensy 3.2s and an audio board. The primary Teensy is connected to the audio board and to a computer via USB. The secondary Teensy is connected to a computer via USB and the primary Teensy via I2S. The primary Teensy is the clock generator for all I2S communications. The secondary Teensy takes USB audio in and pipes it to I2S, and takes I2S audio in and pipes it to USB. Nothing else. The primary takes audio in via USB and quad channel I2S. It has some mixers to select things, etc.

Occasionally (but not always) if I'm taking audio in through the secondary Teensy's USB port, and then start taking audio in on the primary's USB port the secondary's audio will sound horrible. Usually like I've got a clock problem. But not always. Usually stopping playback on the primary Teensy's computer will fix it.

I'm just not entirely sure where to go at this point. If I don't have any patch cords connected to the primary's USB it doesn't seem to happen. But since it doesn't always happen I can't say this for sure. Could it be related to the fact that I had to create a custom 16 bit I2S input/output for the secondary Teensy (since the primary is running I2S_Quad)? Maybe. I did have a similar issue when I had an A2D object connected to the mixer (even with that channel turned down). I attributed it to the fact that on this board I have other things connected to the pins that it uses and that was confusing things. But maybe not?

Chasing intermittent problems is not fun.

Any help or ideas would be appreciated!
 
I should also mention that the system works fine when taking in audio through the audio board or through USB on the primary Teensy. It worked taking in audio from the secondary USB yesterday, but today it's crackly, and the primary will interfere with it. I'm cleaning up some coding to allow more inputs to be active, maybe that will let something show through.

I'd accept that this is a timing issue with the I2S connection, but having that ADC module on the primary Teensy seemed to cause similar sounding issues, so I'm not sure what to think.
 
Just a quick update before I head to bed. I've been hacking away at these issues, and I've made a bit of progress.

I've been working with @gfvalvo's BCLK = 64*Fs I2S blocks (available here: https://forum.pjrc.com/threads/45394-SPDIF-Input-and-Output ), and using them I have managed to be outputting I2S Quad, inputting I2S Stereo, and using ADC and USB all without issues. I still can't seem to get quad input to work. I tried creating an input_i2s64_quad_master block, but the moment I tried to use it with ADC I was back to audio issues. Still not sure why this happens. I wonder if the sampling rate of the ADC (as triggered by the programmable delay block) is causing some kind of issue. But I haven't tracked down why this only seems to be an issue with the quad input block.

Still plugging at it! If anyone has any advice I'm all ears.
 
Status
Not open for further replies.
Back
Top