Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

I2C interface on Linux (with MMU)

I have a few questions about I2C interfaces on Nios II on Linux with MMU.

I found this thread http://www.alteraforum.com/forum/showthread.php?t=18441 (though forum search for "i2c" or "I2C" doesn't find it). It is a bit fragmented, and difficult to follow.

I have a Microtronix i2c interface.

Should the OpenCores drivers work with this?

I defined I2C_0_BASE, I2C_0_IRQ based on my custom_fpga.h

I2C_0_FREQ is being a bit trickier. I assumed it should be the i2c bus speed; however, I discovered that it seems to hang the system at boot if I don't define it as the system clock speed (85 MHz for me).

15 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    > Microtronix sent me their entire Linux distribution.

    What Kernel Version does same use ? The only Microtronix Linux I saw up till now was based on a very old Kernel Version that uses a quite different driver interface.

    To work with the community, you would need to use the community distribution and if you want to use the Microtronix IP-Core supposedly you would need to port the driver to thr new Kernel interface.

    -Michael
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I tried to find the kernel version today. Didn't see any sign of it. Any suggestions on where I should look?

    I did notice that the files were dated May '07. at the latest.

    I did see some differences in the driver structure.

    I've asked the hardware guys about putting in the OpenCores I2C. If that fails, I'll be asking them for a bit-banging interface.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    > the files were dated May '07. at the latest.

    That is what I feared :(

    > If that fails, I'll be asking them for a bit-banging interface.

    That would be very easy for them as it's a simple Bit I/O port.

    -Michael
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Well, I had them switch to the OpenCores I2C interface.

    I pointed them at both http://www.opencores.org/project,i2c and http://www.niosforum.com/pages/project_details.php?p_id=111&t_id=18 as sources for the design.

    I compiled the kernel with I2C_0_FREQ defined as 400000 (400 kHz), and the ds1307 Real Time Clock support.

    The I2C initialized, and the RTC was read.

    I have not tried to write to the RTC, but the OpenCores I2C interface and driver seem to work just fine.