I2C (OpenCores) not working
Hi, I am using the I2C OpenCores v13.0 from https://fpgawiki.intel.com/wiki/I2C_(OpenCores) with the Platform Designer/Qsys and the Nios II Processor on the Quartus Prime, but it isn't working. I don't know what steps I may have done wrong. First I unzip the .zip and added the path of the files to generate the I2C component in Qsys. So in the _sw.tcl file I've changed the "opencores_i2c" by "i2c_opencores" beacuse the _hw.tcl and _sw.tcl name weren't in agreement (https://forums.intel.com/s/question/0D50P00003yyRELSA2/how-to-use-i2copencoresswtcl-in-i2c-opencores). After that I made the C code in Eclipse, as follow:
#include <stdio.h>
#include "system.h"
#include "i2c_opencores.h"
int main(){
int data;
// address to communicate 0x08
// Frequency 100 kHz
I2C_init(I2C_BASE,ALT_CPU_FREQ,100000);
while(1){
I2C_start(I2C_BASE,0x08,1); // chip address in read mode
data = I2C_read(I2C_BASE,1); // read the input register and send stop
printf("data = %d\n",data);
}
return 0;
}
The code compiles without errors or warnings, all the drivers and libraries (i2c_opencores.c, i2c_opencores.h, i2c_opencores_regs.h) were linked to Eclipse automatically. In the Nios console I see nothing, any value received. I also verified the SDA and SCL lines in an oscilloscope, but no signal. If someone can help me, I appreciate it. Below I've attached the configuration in Qsys. Thanks in advance.