Page 1 of 1

I2C Causing Pop in I2S Stream

Posted: Thu Feb 23, 2017 6:33 pm
by RitchRock
Hello,

I am using the xCore-200 Multichanel Audio Platform to prototype my system. I2C is used for writing registers to control the ADC gain. It seems that whenever I do an i2c.write_reg command I get a "pop" in the audio stream. I verified this by commenting out these commands. Is this because, as stated in the i2C user guide, the synchronous API blocks operation until the bus operation is complete, maybe causing a brief interruption in the I2S stream? The two are on the same core because of how the EVM was designed. I thought that maybe trying Asynchronous i2C API would be helpful, but it seems there is no single mulit-bit port version. What should I do about the loud pops in the audio stream?

Thanks!

Re: I2C Causing Pop in I2S Stream

Posted: Thu Mar 09, 2017 11:33 am
by infiniteimprobability
Hi, I assume you are using the various lib_xxx libraries to do this?
You are right that Asynchronous API is the one you need. If you use the normal one, the interface call blocks until completion (all interface calls block the client until the server reaches the end of the case in the server). However, I see your point about lack of single port version.
The alternative is you have a remote core which you send a message to, which then does the I2C coms afterwards. This essentially adds buffering to you transaction and stops the block..

Your buffer task could do something like this (pseudo code ish):

Code: Select all

select{
	case i_message (message_t message):
		buffer = message;
		do_i2c_flag = 1;
		break;

	(do_i2c_flag == 1) => default:
		i_i2c.send(buffer);
		do_i2c_flag = 0;
		break;
}
This will wait for the comms, receive/buffer it quickly and then unblock the client. It will then do the i2c stuff once afterwards.
As long as the I2C transaction is complete before the next message is received, it will not block.

Re: I2C Causing Pop in I2S Stream

Posted: Thu Mar 09, 2017 6:44 pm
by RitchRock
Thank you! I will try this. In the mean-time, I've begun work on my own design where I moved the I2C comms to the tile without I2S.