Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor III
1,278 Views

opencores i2c master generates no output

Hi, 

I'm new to FPGA's. I had used the altera IP's and evrything went well until I tried to use the opencores I2C master. With the DE0-nano board I want commucate via the GPIO_06 and GPIO_05 on an seperate board. But in every communication attempt the SCL and the SDA stay high. The problem is maybe the result of an incorrect implentation of the IP. When I look at system.h file there only these few lines in i2c_opencores configuration: 

 

/* 

* i2c_opencores_0 configuration 

*/ 

# define ALT_MODULE_CLASS_i2c_opencores_0 i2c_opencores# define I2C_OPENCORES_0_BASE 0x4001800# define I2C_OPENCORES_0_IRQ 5# define I2C_OPENCORES_0_IRQ_INTERRUPT_CONTROLLER_ID 0# define I2C_OPENCORES_0_NAME "/dev/i2c_opencores_0"# define I2C_OPENCORES_0_SPAN 32# define I2C_OPENCORES_0_TYPE "i2c_opencores" 

 

Are there missing some lines? 

 

I also had already checked if there is a driver for the i2c_bus. And there is a driver and it is enabled. 

 

When I debug my code on the Nios II the core get stuck in the following line of the i2c_start function: 

 

/* wait for the trnasaction to be over.*/ 

while( IORD_I2C_OPENCORES_SR(base) & I2C_OPENCORES_SR_TIP_MSK); 

 

The return of the function IORD_I2C_OPENCORES_SR(base) is always 0x02. 

 

Has anybody an idea what the problem might be? 

 

Excuse my english, I'm no native speeker.
0 Kudos
3 Replies
Valued Contributor III
18 Views

Re: opencores i2c master generates no output

After changing the SDA and the SCL from one into two seperate conduit interfaces, the i2c_start function doesn't get stuck anymore. But on the bus lines I still can't see any signals so that the I2C-Controller always receives a NACK. 

Has it maybe something to do with the pin configuration? I'm using GPIO_06 for SCL (pin A4 on the FPGA) as an output. SDA is on GPIO_05 (pin B4 on the FPGA) as birdirectional pin. For both pins I have assigned 3.3-V LVTTL as I/O-Standard in the pin planner. 

With this bus I want to communicate with a few TMP112 devices.
0 Kudos
Highlighted
Valued Contributor III
18 Views

Re: opencores i2c master generates no output

The problem is solved. I found the http://www.alterawiki.com/wiki/i2c_(opencores) and started from scratch. I changed everything in the .tcl files as mentioned on the wiki page. Now everything works fine.

0 Kudos
Highlighted
Valued Contributor III
18 Views

Re: opencores i2c master generates no output

The problem is solved. I found the Altera wiki page for i2c_(opencores) (http://www.alterawiki.com/wiki/i2c_(opencores)) and I edited everything in the _sw.tcl and _hw.tcl as mentioned on the page. Now everything works fine.

0 Kudos