Forum: FPGA, VHDL & Verilog Connect FPGA with i2c to a mikrocontroller

von ki92 (Guest)

Attached files:

Rate this post
0 useful
not useful

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


: Moved by Admin
von Lothar M. (lkmiller) (Moderator)

Rate this post
0 useful
not useful
ki92 wrote:
> I have no idea what the problem is.
Did you simulate your text files?
What's the result of that simulation?

von buks (Guest)

Rate this post
0 useful
not useful

Do you still need help on this? I just completed a small design using 
the same I2C core and noticed that it harbours a few "gotchas":

   * The core's signal initialization is not completely defined, which 
mandates an external reset

   * The core can be used either with an asynchronous or synchronous 
reset, the active level for the latter is defined through generic 
ARST_LVL that defaults to '0'. Check the reset level to which rst_i is 
tied in your design

   * The first emission after reset is always truncated - it will miss 
the address part.

   * signal wb_we_i (write enable) is not registered in the core module 
- you might need to hold this signal for a longer period than you think

Also, before enabling the core by setting EN to '1' in the control 
register, you need to program the required I2C clock frequency (clock 
prescale register) according to the formula given in the documentation.

I am not familiar with the reset/start behaviour of your particular 
device, you might also need to add a reset generator to your design.


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.