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.

CCS/TM4C123GH6PM: Connecting an I2C LCD

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: ENERGIA

Tool/software: Code Composer Studio

I'm having difficulty connecting an I2C LCD display to TM4C123G. I'm trying to connect it to J14 on the Grove Base BoosterPack.

http://wiki.seeed.cc/I2C_LCD/ 

  • I've visited the page you've linked - yet cannot (easily) find the "J14" you reference.

    Is it (just) "connecting" between the "123" (assumed LPad) and this (I2C controlled LCD) which is your issue? Reading the page which directly appears from your link reveals that the display board requires 5V for power - yet is "accepting" of the MCU's 3V3 (max) I2C signal levels. How have you supplied 5V to the "I2C Display?" Have you measured the "hoped for" 5V - at the display board? (especially if the Lcd's backlight "turns on by default?")

    A better description (beyond "difficulty connecting") would enable further diagnosis by your "helper crüe." The software features & capabilities of this module are impressive. (as one in the display biz - I (may) just be qualified to make such comment.)
  • Hello Vitaly,

    Try to connect it to J10 which is what is connected to the I2C lines on the TM4C. I don't think you can connect an I2C device to the digital pins such as J14 and control it as I believe the routing for those pins are just to standard GPIO which would not have an I2C peripheral on them.

    cb1, the J14 is part of this BoosterPack: www.seeedstudio.com/Grove-Base-BoosterPack-p-2177.html
  • Ralph - I remain confused - firm/I have "connected successfully" (123 & past LX4F based LPads) many times to "I2C and SPI and UART" controlled (external) devices - never/ever requiring such "booster pack."     (pardon but, "boost" - rings loudly - of "over-sell")       What could be the value - and/or purpose - of any such purported "boost?"      

    Is it not true that simple "Passage of proper/adequate power" and the 2 I2C signals (w/pull-ups)" prove, "ALL that any such I2C device requires?"       

  • Hello cb1,

    The Grove products from SeeedStudio are a hobbyist ecosystem built on every module having a 4 pin connector. It's primarily geared to Arduino, but a group in TI enabled support for it through Energia and a BoosterPack designed to plug onto TI LaunchPad's. The BoosterPack takes the 4 pin connector and routes it to appropriate LPad pins.

    The value is highly debatable (we don't really support Energia and Grove for TM4C), but the purpose is to make it very easy to interface devices to an MCU.
  • I tried connecting it to J10. Pins are 6 and 7.

    #define LCD_SLAVE_ADDR            0x51

    Here's my init function:

    //initialize I2C module 1
    //Slightly modified version of TI's example code
    void InitI2C1(void)
    {
        //enable I2C module 1
        SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C1);
    
        //reset module
        SysCtlPeripheralReset(SYSCTL_PERIPH_I2C1);
    
        //enable GPIO peripheral that contains I2C 1
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    
        // Configure the pin muxing for I2C1 functions on port B2 and B3.
        GPIOPinConfigure(GPIO_PA6_I2C1SCL); //Pin 6
        GPIOPinConfigure(GPIO_PA7_I2C1SDA); //Pin7
    
        // Select the I2C function for these pins.
        GPIOPinTypeI2CSCL(GPIO_PORTA_BASE, GPIO_PIN_6);
        GPIOPinTypeI2C(GPIO_PORTA_BASE, GPIO_PIN_7);
    
        // Enable and initialize the I2C1 master module.  Use the system clock for
        // the I2C1 module.  The last parameter sets the I2C data transfer rate.
        // If false the data rate is set to 100kbps and if true the data rate will
        // be set to 400kbps.
        I2CMasterInitExpClk(I2C1_BASE, SysCtlClockGet(), false);
    
        //clear I2C FIFOs
        HWREG(I2C1_BASE + I2C_O_FIFOCTL) = 80008000;
    }

    Here's my send function:

    //sends an I2C command to the specified slave
    void I2CSend(uint8_t slave_addr, uint8_t num_of_args, ...)
    {
        uint8_t i;
    
        // Tell the master module what address it will place on the bus when
        // communicating with the slave.
        I2CMasterSlaveAddrSet(I2C1_BASE, slave_addr, false);
    
        //stores list of variable number of arguments
        va_list vargs;
    
        //specifies the va_list to "open" and the last fixed argument
        //so vargs knows where to start looking
        va_start(vargs, num_of_args);
    
        //put data to be sent into FIFO
        I2CMasterDataPut(I2C1_BASE, va_arg(vargs, uint32_t));
    
        //if there is only one argument, we only need to use the
        //single send I2C function
        if(num_of_args == 1)
        {
            //Initiate send of data from the MCU
            I2CMasterControl(I2C1_BASE, I2C_MASTER_CMD_SINGLE_SEND);
    
            // Wait until MCU is done transferring.
            while(I2CMasterBusy(I2C1_BASE));
    
            //"close" variable argument list
            va_end(vargs);
        }
    
        //otherwise, we start transmission of multiple bytes on the
        //I2C bus
        else
        {
            //Initiate send of data from the MCU
            I2CMasterControl(I2C1_BASE, I2C_MASTER_CMD_BURST_SEND_START);
    
            // Wait until MCU is done transferring.
            while(I2CMasterBusy(I2C1_BASE));
    
            //send num_of_args-2 pieces of data, using the
            //BURST_SEND_CONT command of the I2C module
            for(i = 1; i < (num_of_args - 1); i++)
            {
                //put next piece of data into I2C FIFO
                I2CMasterDataPut(I2C1_BASE, va_arg(vargs, uint32_t));
                //send next data that was just placed into FIFO
                I2CMasterControl(I2C1_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
    
                // Wait until MCU is done transferring.
                while(I2CMasterBusy(I2C1_BASE));
            }
    
            //put last piece of data into I2C FIFO
            I2CMasterDataPut(I2C1_BASE, va_arg(vargs, uint32_t));
            //send next data that was just placed into FIFO
            I2CMasterControl(I2C1_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH);
            // Wait until MCU is done transferring.
            while(I2CMasterBusy(I2C1_BASE));
    
            //"close" variable args list
            va_end(vargs);
        }
    }

    Here's my write function:

    void WriteChar(uint8_t character)
    {
        I2CSend(LCD_SLAVE_ADDR, 1, character);
    }

    I'm calling it in main:

        InitI2C1();
        char a = 'a';
        WriteChar(a);

    However, still get no output.

  • Hello Vitaliy,

    It looks like your configuration is okay aside from this which I don't think is necessary at all:

    HWREG(I2C1_BASE + I2C_O_FIFOCTL) = 80008000;

    Have you looked at the device you are trying to transmit to to see what the protocol for it is? Is there no initialization that needs to be sent?
    Or is it configured so that the device is setup on it's own and all you need to do is print ASCII characters to it? Even for a Grove product that seems to be too simple to me...
  • What exactly is your problem? Does the screen do nothing?

    Can you see any data moving on the bus? At the very least, you can use a scope to prove your clock speed as a sanity check.
  • Poster Peter's questions are, "Just what the doctor ordered."       Famed, "Does not work" proves "useless" to remote helper crüe...

    Use of any such "boost-less pack" seems an added expense and of (highly) questionable value.      Really - how hard can it be to locate and employ TWO I2C interconnects?      (as always - real (external) pull-up Rs prove most helpful - often mandatory.)