I2C Causing Pop in I2S Stream

If you have a simple question and just want an answer.
Post Reply
RitchRock
XCore Addict
Posts: 186
Joined: Tue Jan 17, 2017 9:25 pm

I2C Causing Pop in I2S Stream

Post 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!


User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post 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.
RitchRock
XCore Addict
Posts: 186
Joined: Tue Jan 17, 2017 9:25 pm

Post 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.
Post Reply