AnsweredAssumed Answered

Switching  I2C lines on Sharc 21369

Question asked by AstroMedGlen on Dec 5, 2011
Latest reply on Dec 6, 2011 by AstroMedGlen

Hello,

 

    I have a unique problem I beleive I need some help for. I have two slave I2C devices connected up to two different pairs of DPI pins. An A/D is connected to Pins 13 and 14 and a fan controller is connected to pins 11 and 12. I have tested both of these devices and I know that they function correctly. The problem switching the DPI pins back and fourth between the two. I do some initial setup like this:

 

    /* Sets the Prescale */
    ustat1 = 0x10|TWIEN;                    // Sets the prescale and IEN
    dm(TWIMITR) = ustat1;                   // Prescale = Fpclk/10MHZ. If PLL remains unchanged, Fpclk  = Fcclk / 2 = 162.5 MHz.
   
    /* Sets the low and high periods of SCL */
    ustat1 = 0x7F|0x7F00;                   // Generates SCL of 400khz or less.
    dm(TWIDIV) = ustat1;                    // 25 total cycles or more.

 

Then I wrote two functions to switch between the two. (The devices work fine at the same frequency)

 

Set_I2C_for_Fans:

 

    // A2D
    SRU2(HIGH,DPI_PB11_I);     
    SRU2(HIGH,DPI_PBEN11_I);                // Enable as Output

 

    SRU2(HIGH,DPI_PB12_I);
    SRU2(HIGH,DPI_PBEN12_I);

 

    // Fans
    SRU2(DPI_PB13_O,TWI_DATA_I);            // I2C SDATA input is connected to DPI pin 13 output
    SRU2(LOW,DPI_PB13_I);     
    SRU2(TWI_DATA_PBEN_O,DPI_PBEN13_I);     // Disables DPI pin 13 as input

 

    SRU2(LOW,DPI_PB14_I);
    SRU2(TWI_CLK_PBEN_O,DPI_PBEN14_I);      // I2C Clock connected to DPI pin 14.

 

Set_I2C_for_Fans.end: rts;

 

Set_I2C_for_A2D:

 

    // Fans
    SRU2(HIGH,DPI_PB13_I);     
    SRU2(HIGH,DPI_PBEN13_I);                // Enable as Output

 

    SRU2(HIGH,DPI_PB14_I);
    SRU2(HIGH,DPI_PBEN14_I);
   
    // A2D
    SRU2(DPI_PB11_O,TWI_DATA_I);            // I2C SDATA input is connected to DPI pin 13 output
    SRU2(LOW,DPI_PB11_I);     
    SRU2(TWI_DATA_PBEN_O,DPI_PBEN11_I);     // Disables DPI pin 13 as input

 

    SRU2(LOW,DPI_PB12_I);
    SRU2(TWI_CLK_PBEN_O,DPI_PBEN12_I);      // I2C Clock connected to DPI pin 14.

 

Set_I2C_for_A2D.end: rts;

 

The only thing I can figure is that I am some how not de-allocating a data pin from the TWI data signal??? And I am possibly driving the signal with two different pin imputs. Is there an SRU statement that I am missing in order to accomplish this?

 

I know that I could get around this just by connecting the devices to the same bus. In this particular hardware situation, this is not possible right now.

Outcomes