cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Visitor
Visitor
28,217 Views
Registered: ‎09-23-2011

How to use FPGA interface I2C with VHDL ?

I want to connect IC SAA7113 which it have to interface with I2C bus. So, I want to use FPGA Spartan3 interface I2C with VHDL. I downloaded I2C Master Slave Core from http://opencores.org/project,i2c_master_slave . But I don't understand how to send data between master and slave. The code I2C Master Slave Core show connect between slave and master only. How to send my data between master and slave ?  If you have some example with VHDL or easier solution about interface SAA7113 in FPGA please help me.

Tags (1)
0 Kudos
Reply
10 Replies
Advisor
Advisor
28,199 Views
Registered: ‎10-05-2010

The code you linked looks very complex and has virtually no comments. I2C isn't a complicated protocol, so it would be a good exercise to implement your own I2C controller from scratch. A lot of the things you'll find on OpenCores will waste more of your time than they save!

 

fpga4fun.com has a short section on I2C, and unfortunately only a simple slave implementation.

 

0 Kudos
Reply
Teacher
Teacher
28,191 Views
Registered: ‎09-09-2010

It looks like you may have to send quite a lot of set-up data to the SAA7113. It may be easier to do that control task from an embedded processor, such as the MicroBlaze.

------------------------------------------
"If it don't work in simulation, it won't work on the board."
0 Kudos
Reply
Instructor
Instructor
28,190 Views
Registered: ‎07-21-2009

It looks like you may have to send quite a lot of set-up data to the SAA7113. It may be easier to do that control task from an embedded processor, such as the MicroBlaze.

 

Or configure a BRAM as a ROM, and stream the data from the ROM to the SAA7113 in one I2C transfer at startup.  This should be a simple state machine design.

 

One BRAM is large enough to hold several 'profiles'.  Each 'profile' requires 95 bytes.  A single 8Kbit BRAM can hold 10 'profiles'.

 

-- Bob Elkind

SIGNATURE:
README for newbies is here: http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369

Summary:
1. Read the manual or user guide. Have you read the manual? Can you find the manual?
2. Search the forums (and search the web) for similar topics.
3. Do not post the same question on multiple forums.
4. Do not post a new topic or question on someone else's thread, start a new thread!
5. Students: Copying code is not the same as learning to design.
6 "It does not work" is not a question which can be answered. Provide useful details (with webpage, datasheet links, please).
7. You are not charged extra fees for comments in your code.
8. I am not paid for forum posts. If I write a good post, then I have been good for nothing.
0 Kudos
Reply
Visitor
Visitor
28,171 Views
Registered: ‎09-23-2011

If I use Microblaze it will be embeded system. That I'm not sure can it use parallel processing or it can use sequential statement only ? I want to interface multiple camera like this http://www.springerlink.com/content/e78t5332205q5n17/fulltext.pdf  . How to do that ?

0 Kudos
Reply
Advisor
Advisor
28,167 Views
Registered: ‎10-05-2010

I2C on this chip only seems to be used for configuring registers, not for the video output itself. You could use one soft processor to program multiple chips, one after another, if you didn't care about registers being set at identical times (I'm not sure why you would).

 

If you wanted to process the video stream using MicroBlaze, you could do that too, or you could do it in pure HDL, or you could use multiple MicroBlaze cores, or whatever. Your design requirements should lead to the best choice.

0 Kudos
Reply
Adventurer
Adventurer
28,155 Views
Registered: ‎01-21-2011

Hi,

 

like others said, you need the microcontroller and write the software to load the SA7113.

Microcontroller can be almost anything from soft core like MicroBlaze or real one. 

 

When you deterine which is your uC, then you go to implemnt the I2C protocol,  and again you have lot of choices, there're many many diferrent ways to do this

 

Notes that I2C is serial communication, you can talk to only one slave at a time

 

 

 

 

 

 

0 Kudos
Reply
25,071 Views
Registered: ‎09-04-2013

 Agreed and you might want to check out this simple I2C core as well as it was cost effective and very compact:

 

SkytekIPCoresI2C

 

 

0 Kudos
Reply
Adventurer
Adventurer
18,599 Views
Registered: ‎07-09-2014

I was able to read different ICs with another opencores project at http://opencores.org/project,i2c. However it is wishbone compatible and seems complex.

 

A simple master module is in here https://www.eewiki.net/display/LOGIC/I2C+Master+(VHDL)

I plan to work on it but haven't used it yet.

0 Kudos
Reply
Adventurer
Adventurer
18,262 Views
Registered: ‎07-04-2013

Hi,

 

Use the file "i2c_master_v01" from the project you have specified, its a simple I2C Core which acts as a Master; design a wrapper around it which will perform Writes/Reads and as Bob has suggest configure a ROM to store the Startup data from which the state-machine will read the data and give to the I2C Core.

 

 

I2C.bmp
0 Kudos
Reply
Explorer
Explorer
5,470 Views
Registered: ‎06-25-2014

A further option to considier is using a small footprint Picoblaze which comes with an I2C reference design that I have succesfully used in the past. Download here:

 

http://www.xilinx.com/ipcenter/processor_central/picoblaze/member/

0 Kudos
Reply