Go to previous topic
Go to next topic
Last Post 16 Dec 2006 03:31 AM by  joy@zeuslearning.com
Problem in using I2c Bus
 0 Replies
Author Messages
joy@zeuslearning.com
New Member
New Member
Posts:


--
16 Dec 2006 03:31 AM
    I am trying to interface a keyboard with the dev kit through the MAX7349 controller using the I2C module of the 79524.
    I have taken connection form Expansion slot J38's pin 57 (MFP23,K2) as SCL and pin 58 (MFP24,K3) as SDA

    I first wrote a small C program in Logic Loader but when I tried to access the MUXCTRL4 register to define I2C for the i/o pins, I get a segmentation fault. What am I doing wrong?
    So instead I tried to create a small module inside the Linux kernel. This is what I do inside the code (I am writing directly to the internal registers of the 79524 and not using any other software routines provided in the kernel.

    To configure PA7 as SCL, i have set MUXCTL4 (addr 0xfffe5018) register's pin 11 : 10 = 1 : 1 and
    To configure PA6 as SDA, i have set MUXCTL4 (addr 0xfffe5018) register's pin 9 : 8 = 1 : 1
    To configure this registers as pull-up, i have set RESCTL4 (addr 0xfffe501c) register's pin 11 : 10 = 1 : 0 and pin 9 : 8 = 1 : 0
    and then set ICCON register mode with 7 bit master mode (10), enable with 1, & speed with std mode (0)
    and ICHCNT register with 0xc9 and ICLCNT register with 0xec

    I set the ICDATA register to the 7-bit address of the slave/peripheral I2C device with a read/write control bit set to 1 (for reading)
    (8bit value7 bit Address + Read/Write bit)

    Then I initiate an I2C transaction by setting the Start bit in the ICCON register.
    Next I set the ICDATA register to the command byte( select the type of register to read from the peripheral device)

    I wait till the IDLE state in the ICSTATUS register becomes 1 again.

    However no data seems to be read back to the ICDATA register. (It still contains the command byte rather than the value of the command register of the peripheral device). The above instructions are written in a kernel level program. In this case we are able to access all the registers. But no I2C transaction seems to take place.

    Can someone point out what I need to do in order to get the I2C module in the 79524


    ---