Forum Discussion
Altera_Forum
Honored Contributor
16 years ago<div class='quotetop'>QUOTE (mschnell @ Jul 10 2009, 05:56 AM) <{post_snapback}> (index.php?act=findpost&pid=23062)</div>
--- Quote Start --- You just need to create an appropriate driver for the I²C chip you want to use.[/b] --- Quote End --- I already selected "I2C Device Interface" and "OpenCores I2C Controller" in my Kernel configuration and as mentionned previously, I can send I2C frames from the master part (NIOS II) to the selected slave (a temperature sensor) but I don't receive ACK or data from the I2C slave on the screen, whereas on the scope, I can see the ACK bit low (=defined)... Here is the simple code used, based on the HAL functions : --------------------------------------------------------------------------- /* these test were created to show how to use the opencores i2c along with a driver found in * the opencores_I2C component to talk to various components. * This test example uses a littel daughter board from microtronix * it has a I2c to parallel chip (PCA9554A) a EEPORM and real time clock. */ I2C_init(na_i2c,na_i2c_clock_freq,100000); I2C_start(na_i2c,0x4a,0); //set chip address in write mode I2C_write(na_i2c,0,0); // write the first index of the register that must be read I2C_start(na_i2c,0x4a,1); //set chip address in read mode data = I2C_read(na_i2c,0); // read continues after this burst printf("\tdata = 0x%x\n",data); data = I2C_read(na_i2c,1); // last read printf("\tdata = 0x%x\n",data); --------------------------------------------------------------------------- If I understand well, every time I add an I2C slave on the bus controlled by the master, I must write a I2C chip driver in the folder <nios2-linux/linux-2.6/drivers/i2c/chips> and recompile ??? The interrupt problem cannot be resolved with an easier solution regarding my system ?? I only need to retrieve data... Thanks for your help, I'm a little confused between I2C core, I2C bus drivers, I2C algorithm drivers and I2C chip drivers :(