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/CC2650: Various errors implementing HDC1010

Part Number: CC2650
Other Parts Discussed in Thread: HDC1010, , HDC1000,

Tool/software: Code Composer Studio

I have a custom board with CC2605MODA and HDC1010 mounted on it.

When I try to write a firmware to establish connection between the two I get some weird errors.

1) When the optimization level is 3 or 4, I get several errors around symbols being declared at multiple places.

The problem is when I go to parts of the code where the symbol is supposedly redefined, there is no such thing.

The linker tells me there are redefinition at certain obj files and I assume I should be able to find the redefinition at corresponding c files.

These symbols are unique to HDC1010 firmware (I got it here: http://www.ti.com/tool/TIDA-00374 and they didn't exist in the code before I started integrating the firmware.

The errors go away when I lower the optimization level to 2 or lower.

2) My code base is simple_ble_peripheral I got from the BLE stack and it was working fine before even after I made some modification.

After I made some more changes to the board file and the task file, the code stalls at GAP_SetParamValue.

To be precise, GAP_SetParamValue -> sendWaitMatchCS -> waitMatchCS -> ICALL_ERRNO_UNKNOWN_THREAD.

I assume this is not supposed to happen in correctly implemented device, but I can't understand what this means.

After ICALL_ERRNO_UNKNOWN_THREAD, the code stops executing without being in a infinite loop or raising an error.

  • Hi,

    Regarding your second question, can you post some code snippet regarding the changes you made?
  • Changes in CC2650_LAUNCH.h

    /** ============================================================================
    * Global variables
    * ==========================================================================*/
    I2C_Handle AppI2cHandle;
    I2C_Params AppI2cParams;
    I2C_Transaction i2cTransaction;

    /* I2C */
    #define Board_I2C0_SCL0 IOID_5
    #define Board_I2C0_SDA0 IOID_6
    #define Board_HDC_nDRDY IOID_7

    Changes in CC2650_LAUNCH.c

    const PIN_Config BoardGpioInitTable[] = {
    Board_HDC_nDRDY | PIN_INPUT_EN | PIN_NOPULL | PIN_HYSTERESIS, /* HDC data ready pin */
    Board_I2C0_SDA0 | PIN_INPUT_EN | PIN_NOPULL | PIN_HYSTERESIS, /* I2C */
    Board_I2C0_SCL0 | PIN_INPUT_EN | PIN_NOPULL | PIN_HYSTERESIS, /* I2C */
    PIN_TERMINATE
    };

    Changes in simple_peripheral.h

    /*****************************************************************************
    * DEFINES
    */

    #define HDC1000_ADDRESS 0x40 //I2C address for HDC1000

    #define HDC1000_TEMP_ADDR 0x00 //Temperature measurement output register
    #define HDC1000_HUMIDITY_ADDR 0x01 //Relative humidity output register
    #define HDC1000_CONFIG_ADDR 0x02 //HDC1000 configuration and status

    #define HDC1000_MAN_ID_ADDR 0xFE //Manufacturer ID register (default: 'TI')

    /*
    CONFIGURATION REGISTER DESCRIPTION
    ============================================
    Name Registers Description Configuration
    RST [15] SW reset 0: Normal operation
    Rsvd [14] Reserved N/A
    HEAT [13] Heater 0: Heater disabled
    MODE [12] Mode of acquisition 1: Temp&Humidity in sequence
    BTST [11] Battery status N/A
    TRES [10] Temp resolution 1: 11 bit
    HRES [9:8] Humidity resolution 01: 11 bit
    Rsvd [7:0] Reserved N/A
    */
    #define HDC1000_TEMP_RH_11BIT_MSB 0x15 //MSB of configuration
    #define HDC1000_TEMP_RF_11BIT_LSB 0x00 //LSB of configuration

    /* HDC1000 timing */
    #define HDC_START_TIME 8000 /* Delay before first HDC I2C access */
    #define HDC_MEAS_TIME 8000 /* Delay between start of conversion to measurement read */
    #define HDC_CONFIG_TIME 1000 /* Amount of time to wait until I2C retry after failed attempt */

    /* HDC1000 data ready trigger */
    #define HDC_MEAS_INTERRUPT 0
    #define HDC_MEAS_DELAY 1
    #define HDC_MEAS_METHOD HDC_MEAS_DELAY
    Changes in simple_peripheral.c

    //I2C variables
    extern I2C_Handle AppI2cHandle;
    extern I2C_Params AppI2cParams;
    extern I2C_Transaction i2cTransaction;
    uint8_t txBuf[3] = {0};
    bool status = false;

    static uint8_t HDC_data[4];

    //Clock management
    static Semaphore_Struct hdcSyncSem;
    static Semaphore_Handle hdcSyncSemHandle;
    static Clock_Struct hdcSyncClock;
    static Clock_Handle hdcSyncClockHandle;

    (in main task function, not in main loop)
    /* Initialize I2C */
    I2C_Params_init(&AppI2cParams);
    AppI2cParams.transferMode = I2C_MODE_BLOCKING;
    AppI2cParams.transferCallbackFxn = NULL;
    AppI2cParams.bitRate = I2C_400kHz;
    AppI2cHandle = I2C_open(CC2650_LAUNCHXL_I2C0, NULL);
    if(AppI2cHandle == NULL){}
  • Can you make sure that in your board file, the following part is set? This is the HWAttr that actually take in all the pins for I2C to do initialization.
    /* I2C configuration structure, describing which pins are to be used */
    const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2650STK_I2CCOUNT] = {
    {
    .baseAddr = I2C0_BASE,
    .powerMngrId = PowerCC26XX_PERIPH_I2C0,
    .intNum = INT_I2C_IRQ,
    .intPriority = ~0,
    .swiPriority = 0,
    .sdaPin = Board_I2C0_SDA0,
    .sclPin = Board_I2C0_SCL0,
    }
    };


    Also did you get a proper handle in return? You don't need to have your I2C pins to be in the BoardGpioInitTable.
  • HWAttr is properly set.

    Do I need the handle of the I2C pins? I don't think I saw anything like that on the sample application.

  • this is your I2C handle --> (AppI2cHandle). Can you check if it returns valid values other than NULL?
  • You mean this part of the code, right?

    AppI2cHandle = I2C_open(CC2650_LAUNCHXL_I2C0, NULL);

    I can't check if it returns NULL normally. The code never reaches that point.

    It fails at 

    GAP_SetParamValue(TGAP_CONN_PAUSE_PERIPHERAL, DEFAULT_CONN_PAUSE_PERIPHERAL);

    which is far earlier in the code.

    However, when I move the code up to the earlier point, I can see that it is not NULL. It is type struct I2C_Config* with some hex value.

    I wonder if whatever complains about level 4 optimization has something to do with it.

    I have

    extern I2C_Handle       AppI2cHandle;
    extern I2C_Params       AppI2cParams;
    extern I2C_Transaction  i2cTransaction;

    in simple_peripheral.c and

    I2C_Handle       AppI2cHandle;
    I2C_Params       AppI2cParams;
    I2C_Transaction  i2cTransaction;

    in CC2650_LAUNCHXL.h.

    It follows the scheme in the sample code but the linker complains about these "symbols has already been defined."

    When I remove either snippet, it complains about not being defined.

  • Hi,

    I would recommend you to check how sensortag project use humidity sensor HDC1000, which use the same interface.