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.

Easy Link Issue with I2C

Other Parts Discussed in Thread: TM4C123GH6PM

Hi TI:

Setup - TIVA TM4C123GH6PM, TI-RTOS 1.10.0.23, Compiler 5.06.

I started with the uartconsole_TIVA example.  Compiled it.  Ran it against putty.  Worked great.

I decided to expand out a little bit and included a little bit of I2C.

1. I added I2C to the TI-RTOS Config. 

    I have the little Green Checkbox with the "var I2C = xdc.useModule('ti.drivers.I2C');" clearly showing in the script.

2. Added a header  #include <ti/drivers/I2C.h>

3. I added Board_initI2C() amongst the other Init lines.

Board_initUART();

Board_initI2C();  <---- RIGHT HERE!!!!

Board_initUSB(Board_USBDEVICE);

That's it. 

It compiles just fine.

When I Link, I come up with Undefined Symbol Board_initI2C

I am not sure where to turn to from here.  I looked at the i2ceeprom example from the F28; but, it's not yielding any clues.

For instance, I'm not seeing any I2C.c / .h  files in the F28 Project.  I am seeing a "rtsv7M3_T_le_eabi.lib"; but, that does not appear to be compatible with my board.  I tried "rtsv7M4_T_le_v4SPD16_eabi.lib"; but, that is not helping.

Lost on this one.  Any help would be great.

Thanks

Rick

 

 

 

  • Rick,

    we forgot to add a macro for Board_I2C() in Board.h (since we didn't have any I2C examples and prepopulated it with a I2C_config[] structure).

    This will be added in the next release, but these code snippets should help you out.

    You'll have 3 files to make changes. "Board.h", "EK_TM4C123GXL.h", and "EK_TM4C123GXL.c"

    Board.h:

    #define Board_I2C  EK_TM4C123GXL_I2C3
    #define Board_I2C1 EK_TM4C123GXL_I2C0

    EK_TM4C123GXL.h:

    /*!
     *  @def    EK_TM4C123GXL_I2CName
     *  @brief  Enum of I2C names on the EK_TM4C123GXL dev board
     */
    typedef enum EK_TM4C123GXL_I2CName {
        EK_TM4C123GXL_I2C1 = 0,
        EK_TM4C123GXL_I2C3,

        EK_TM4C123GXL_I2CCOUNT
    } EK_TM4C123GXL_I2CName;


    EK_TM4C123GXL.c:

    #if TI_DRIVERS_I2C_INCLUDED
    #include <ti/drivers/I2C.h>
    #include <ti/drivers/i2c/I2CTiva.h>

    /* I2C objects */
    I2CTiva_Object i2cTivaObjects[EK_TM4C123GXL_I2CCOUNT];

    /* I2C configuration structure, describing which pins are to be used */
    const I2CTiva_HWAttrs i2cTivaHWAttrs[EK_TM4C123GXL_I2CCOUNT] = {
        {I2C1_BASE, INT_I2C1},
        {I2C3_BASE, INT_I2C3},
    };

    const I2C_Config I2C_config[] = {
        {&I2CTiva_fxnTable, &i2cTivaObjects[0], &i2cTivaHWAttrs[0]},
        {&I2CTiva_fxnTable, &i2cTivaObjects[1], &i2cTivaHWAttrs[1]},
        {NULL, NULL, NULL}
    };

    /*
     *  ======== LM4F120H5QR_initI2C ========
     */
    Void EK_TM4C123GXL_initI2C(Void)
    {
        /* I2C1 Init */
        /* Enable the peripheral */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C1);

        /* Configure the appropriate pins to be I2C instead of GPIO. */
        GPIOPinConfigure(GPIO_PA6_I2C1SCL);
        GPIOPinConfigure(GPIO_PA7_I2C1SDA);
        GPIOPinTypeI2CSCL(GPIO_PORTA_BASE, GPIO_PIN_6);
        GPIOPinTypeI2C(GPIO_PORTA_BASE, GPIO_PIN_7);

        /* I2C3 Init */
        /* Enable the peripheral */
        SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C3);

        /* Configure the appropriate pins to be I2C instead of GPIO. */
        GPIOPinConfigure(GPIO_PD0_I2C3SCL);
        GPIOPinConfigure(GPIO_PD1_I2C3SDA);
        GPIOPinTypeI2CSCL(GPIO_PORTD_BASE, GPIO_PIN_0);
        GPIOPinTypeI2C(GPIO_PORTD_BASE, GPIO_PIN_1);

        /*
         * These GPIOs are connected to PD0 and PD1 and need to be brought into a
         * GPIO input state so they don't interfere with I2C communications.
         */
        GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_6);
        GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_7);

        I2C_init();
    }
    #endif /* TI_DRIVERS_I2C_INCLUDED */

  • Hey Tom:

    Trying this right now.  Thank you for the quick reply.  Will keep you posted.

    Thank you.

    Rick

     

  • I forgot you also need to add in "Board.h":

    #define Board_initI2C                EK_TM4C123GXL_initI2C

  • Hey Tom:

    Everything looked great except...  this popped up as soon as Linking started.

    undefined             first referenced                                                                                                    

      symbol                   in file                                                                                                         

    ---------             ----------------                                                                                                    

    __TI_decompress_none                                                                                                                      

    __TI_decompress_rle24                                                                                                                     

    __TI_zero_init                                                                                                                            

    _args_main           

     

    I understood the portions of code that you gave me. 

    Any thoughts about this?  I was wondering if I should start afresh or if you had further insight.

    Again, thank you very much for helping.

    Rick

     

     

     

     

  • Rick,

    it's rather difficult to determine what might be causing this link error.. I'm working if something was inadvertently changes in the linker settings. In your CCS project settings, check if the "Runtime support library" is to "<automatic>".

    Also, which version of CCS 5.4 are you using?

    Does a stock TI-RTOS example compile for you with the ARM compiler 5.06? We only tested it with version 5.0.4.

  • Hey Tom,

    Thank you for the response.  I decided to start from scratch.  All is well.

    I noticed that the Board_initI2C(); line gets flagged with "function declared implicitly" on compile.  The program does Compile and Link.

    I did insert this line on Boards.h

    #define Board_initI2C EK_TM4C123GXL_initI2C    Any thoughts?

    For now, all seems well...  Thank you again for helping.

    Rick

     

  • Rick,

    I knew I forgot something....

    That warning will go away once you add the function prototype in EK_TM4C123GXL.h:

    extern Void EK_TM4C123GXL_initI2C(Void);

    All of these changes will be in the next TI-RTOS release.

  • Tom:

    You nailed it!  Thank you very much.

    OK, now... to start hooking things up...

    Rick