Author Topic: Connect FPGA with i2c to a mikrocontroller  (Read 2073 times)

0 Members and 1 Guest are viewing this topic.

Offline ki92Topic starter

  • Newbie
  • Posts: 2
  • Country: de
Connect FPGA with i2c to a mikrocontroller
« on: May 29, 2017, 12:24:42 pm »
Hi,

im trying to connect a FPGA (Altera DE0) via i2c to a mikrocontroller (Arduino, RaspberryPi, etc ...)  using copencores i2c-core.
I programmed already the toplevel for the i2c-core with VHDL to write from the FPGA via the i2c bus to the mikrocontroller.
(FPGA is the master and the mikrocontroller on the other side the slave)

The problem: I cant see any signal on the clock line and also on the data line with the oscilloscope.
Im 100% sure that the pinassignment ist correct.

Can someone look over my code to detect the problem?
I have no idea what the problem is.

Im new to VDHL maybe I did something wrong.

The code I programmed: i2c_controller_top.vhd and writeDummy.vhd

Thanks

 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Connect FPGA with i2c to a mikrocontroller
« Reply #1 on: May 29, 2017, 05:10:52 pm »
That is simply too much code to look through.  I didn't see the file (.ucf ?) where you assigned the pins.  It's not clear to me why you have 3 clock related lines and 3 data related lines.  Ordinarily, you would use tristate outputs (declared as INOUT).

ETA:  I see there is a 2d '***_top.vhdl' file with the pins declared as INOUT.  Oops!

Here is some code that is smaller but the interface is a little different.  Don't know if it matters.

https://eewiki.net/pages/viewpage.action?pageId=10125324

I had a project in an FPGA where I wanted to send a stream to an LPC1768 (mbed) at around 10 MHz.  So, I used SPI and never looked back.

Given a choice, I would never use I2C.
« Last Edit: May 29, 2017, 07:22:18 pm by rstofer »
 
The following users thanked this post: JPortici

Offline ki92Topic starter

  • Newbie
  • Posts: 2
  • Country: de
Re: Connect FPGA with i2c to a mikrocontroller
« Reply #2 on: May 30, 2017, 07:54:51 am »
Im not allowed to use another core! :/
 

Offline Daixiwen

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: no
Re: Connect FPGA with i2c to a mikrocontroller
« Reply #3 on: May 30, 2017, 08:11:20 am »
Are there pull-ups on your i2c signals? The master expects pull ups, it will just drive the signals low or keep then in high impedance.
Can you put some signaltap probes in your FPGA design to see if anything happens in the I2C core?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf