This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

I2C Pull ups?



Hello,

I am using Stellaris Launchpad with LM4F and I wanted to use the I2C0 as a Master. I used the API for configuring:

GPIOPinConfigure(GPIO_PB2_I2C0SCL);// 0x00010803

GPIOPinConfigure(GPIO_PB3_I2C0SDA);// 0x00010C03

GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);
GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);

Uart_Send(UART0_BASE,"I2C GPIO DONE\n\r\0",0);
I2CMasterInitExpClk(I2C0_MASTER_BASE,SysCtlClockGet(),false);

SDA is as expected high (3,3V) because of the weak pull up. The SCL-line is always around 0,6V. I dont check it...

In the data sheet (page 949)  there is mentioned that the clock pin has an active pull up and should not be configured as open drain. In the API I saw that the pin is configured as push/pull. I wanted to use the internal pullups but I can't configure the SCL-Pin: it is never high (except when I conigure it as output and write '1'). Should I use external pull ups? It is stupid when I am not allowed to configure the SCL as open drain. 2 parallel pull ups (internal + external)? What can I do to fix this problem?

Greets, Matthias

 

  • Feel your pain - delay/frustration saved via use of simple, external pull-ups. 

    Datasheet sometimes benefits from "real-world" trial/error - we've operated I2C successfully w/LX4F - always using external pull-ups - each pin.  Removing the pull-ups most always ends the communication - despite datasheet protest...

    IMHO - inclusion of these pull-ups, and RS232 level translator IC - on this board - would have made "launch" far smoother/easier - but added cost & size...  Should your chosen I2C pins reach the board's header - easy enough to create small "kludge" board to hold pull-ups, and any other "accessories" (i.e. mini pot(s) for ADC, RS232 level xlator) which aid experimentation & utility... (i.e. a "real" launch...)

  • Thank you!

    How did you configure the SCL pin when you used external pull ups? Still "STD" (push/pull)?

    BG

  • Here's "known good" code - works several hundred our LX4s:

    void   
    i2c_setup(void)
    {
            ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C1);
       
            GPIOPinTypeI2CSCL(GPIO_PORTA_BASE, GPIO_PIN_6);   //   I2CSCL 
            ROM_GPIOPinTypeI2C(GPIO_PORTA_BASE, GPIO_PIN_7);   
       
            ROM_GPIOPinConfigure(GPIO_PA6_I2C1SCL);   
            ROM_GPIOPinConfigure(GPIO_PA7_I2C1SDA);
    }

    Suggest that you avoid any other methods - we've transacted w/multiple I2C slaves successfully - using just this set-up/config.

  • Thank you for your help, cb1_mobile.

    TI should update the errata for I2C problems, because the active internal pullup is not working. After I added the pull ups I recognized that even the MasterError-API is wrong...

    How does the rest of the API and the peripherials work? I tried different UARTs (some with interrupt), Timer Interrupt that worked quite good. But I can't try more because unfortunately I destroyed my board when I disconnected it in anger and I can't solder it. 


    BG