Altera_Forum
Honored Contributor
10 years agoTrouble with I2C on Altera De-2 board
So we're doing a project at uni based on the DE-2 115 development board. What we need to do is basically to make an application that plays audio from the audio input using the codec, and we need to be able to change the volume of the audio as well.
However, we are stuck at an early stage, as we cannot even generate the I2C data sequence correctly. Thus, we are not able to initialize the control registers of the codec, and no audio can be heard. We have created a module generating the I2C data sequences required to initialize the codec. When simulating this in modelsim everything looks fine. I'm pretty sure the timing is correct, and as we are using quite a slow clock for SCLK (20 khz) I'm thinking this isn't the issue either. In order to troubleshoot this, we assigned the SCLK and SDAT to two GPIO pins, and analyzed the result with a logic analyzer. The pins seem to be driven high ar all times, and no data sequence or clock is seen. Here comes the funny part. Given the pull-up nature of the I2C bus as well as the GPIO pins, we are writing 'Z' to the pin when we want it to be high, and '0' when we want it to be low, using std_logic. And as I explained before, this only results in a constant high value of SCLK and SDAT. However, if we use '1' and '0' for high and low respectively, everything seems to be fine on the logic analyzer. We haven't dared to try using std_logic '1' and '0' on the actual bus, as it is not a good idea to write a '1' to a pull-up bus (?) Is there anyone who can shed some light on this issue? I'm very confused :cry: