Intel® FPGA University Program
University Program Material, Education Boards, and Laboratory Exercises
1184 Discussions

old altera avalon i2c on DE1 board

Honored Contributor II


Some times ago, I made a project onto a cyclone3dev board, the one with two HSMCards, video converter and DVI output cards.  

The two converters were configured by an I2C hardware module (provided by Altera into the zip file - it was the vip_example_design_3c120_v91_revB) accessed by a function in NIOS2.  

Now, I would like to use the same module to be able to software configure the audio codec on the DE1 board. I don't wanto to use these ( from opencores since including them in quartus subscription edition (evaluation license) 11.1sp2 leads to lots of errors in qsys. 

Now, the modules I found are in the zip file, the (main) questions are about  

a) clock divider (using a 50Mhz clock I should use a prescalre of 200, am I right?) 

b)software writing to the modules: it should be something like this 


--- Quote Start ---  


i2c_write(OPENCORES_I2C_MASTER_0_BASE, 0x35, 0x1E<<1, 0x00);//RESET 


--- Quote End ---  


where OPENCORES_I2C_MASTER_0_BASE is the memory mapped address in the BSP, 0x35 is the write address for the device, 0x1e and 0x00 are register and data to write, in a strange mixed cpp environment.  

c) I know it's an unuseful question, but why aren't them working for my module since they correctly configured all the video modules on the 3c120board? 


In the attached zip there are hdl modules and *.hpp sources.  

Any hint would be very appreciated.  

Best regards,  

0 Kudos
1 Reply
Honored Contributor II

BTW, following the procedure described here ( byzetabit ( , I managed to interface nios2 with wm8731 via I2C.  

The funny fact is that in DE1 datasheet I2C address is set to 0x35write and 0x34read. Using opencores'modules, working write address is 0x1A. 

I'll try with that address in my old I2C project.
0 Kudos