Forum Discussion
Altera_Forum
Honored Contributor
16 years agoIf using the Linux Kernel I²C subsystem, you don't need to bother with the HAL or any hardware addresses, at all.
This: >>IOWR_OPENCORES_I2C_CR(base, OPENCORES_I2C_CR_RD_MSK | >>OPENCORES_I2C_CR_NACK_MSK | OPENCORES_I2C_CR_STO_MSK); Seems to be direct hardware acces and not using the I²C subsystem and the Kernel driver for the OpenCores interface (be it enabled otr not). Unfortunately I did not yet use the I²C subsystem, so I can't help with it's interface, but I think it can used only by Kernel drivers. I suppose that the ACK receiving is done by the line driver and not in the responsibility of the chip driver. How do you know that you don't receive an ACK ? This might be some interrupt issue. If using a Kernel driver for the interface hardware', you are not allowed to access these hardware registers by any other software. Do you know that the bits are set to the chip ? >>>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 ??? I suppose this is true. >>>The interrupt problem cannot be resolved with an easier solution regarding my system ?? I only need to retrieve data... I suppose the OpenCores I²C interface "hardware" and the appropriate driver (that you already seem to have successfully compiled) do handle th interrupt for you. Using the I²C subsystem should be easier and more portable than to do everything from scratch in whatever way. So what are you trying to accomplish ? Happy hunting and let us know what you find ! -Michael