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/CC2650MODA: How to control GPIO on CC2650MODA in simple central project

Part Number: CC2650MODA
Other Parts Discussed in Thread: BOOSTXL-CC2650MA

Tool/software: Code Composer Studio

Hi all,

I want to run simple central project on CC2650MODA, using UART and GPIO to communicate with other device.

I have run simple central project on LaunchPad and it word well.

I try to run this project on CC2650MA, so I use  "simple_central_cc2650em" project and change the predefined symbol to "BOOSTXL_CC2650MA".

However, I can not control GPIO for some unknown reason.

I have tried two ways to open GPIO.

The first way is open GPIO in simple_central.c. I open the PIN  defined in BoardGpioInitTable after "SimpleBLECentral_init()" function.

 "PIN_open(&self_define_pin_state, BoardGpioInitTable)" where "BoardGpioInitTable" is defined in "BOOSTXL_CC2650MA.c".

The second way is open GPIO in boead_key.c,  by calling "hKeyPins = PIN_open(&keyPins, keyPinsCfg)".

Here is the way I open PIN in "boead_key.c" :

PIN_Config keyPinsCfg[] =
{
#if defined (CC2650_LAUNCHXL) || defined (CC1350_LAUNCHXL)
    Board_BTN1          | PIN_GPIO_OUTPUT_DIS  | PIN_INPUT_EN  |  PIN_PULLUP,
    Board_BTN2          | PIN_GPIO_OUTPUT_DIS  | PIN_INPUT_EN  |  PIN_PULLUP,
    Board_UART_RX_IRQ   | PIN_GPIO_OUTPUT_DIS  | PIN_INPUT_EN  |  PIN_PULLDOWN,
#elif defined (CC2650DK_7ID)  || defined (CC1350DK_7XD)
    Board_KEY_SELECT    | PIN_GPIO_OUTPUT_DIS  | PIN_INPUT_EN  |  PIN_PULLUP,
    Board_KEY_UP        | PIN_GPIO_OUTPUT_DIS  | PIN_INPUT_EN  |  PIN_PULLUP,
    Board_KEY_DOWN      | PIN_GPIO_OUTPUT_DIS  | PIN_INPUT_EN  |  PIN_PULLUP,
    Board_KEY_LEFT      | PIN_GPIO_OUTPUT_DIS  | PIN_INPUT_EN  |  PIN_PULLUP,
    Board_KEY_RIGHT     | PIN_GPIO_OUTPUT_DIS  | PIN_INPUT_EN  |  PIN_PULLUP,
#endif
    PIN_MEM_INS | PIN_GPIO_OUTPUT_DIS  | PIN_INPUT_EN | PIN_PULLUP,
    PIN_MEM_REQ | PIN_GPIO_OUTPUT_DIS  | PIN_INPUT_EN | PIN_PULLUP,
    PIN_MEM_BZY | PIN_GPIO_OUTPUT_DIS  | PIN_INPUT_EN | PIN_PULLUP,
    PIN_MEM_SEL | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
    PIN_MEM_TEST | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,
    PIN_TERMINATE
};


/*********************************************************************
 * PUBLIC FUNCTIONS
 */
/*********************************************************************
 * @fn      Board_initKeys
 *
 * @brief   Enable interrupts for keys on GPIOs.
 *
 * @param   appKeyCB - application key pressed callback
 *
 * @return  none
 */
void Board_initKeys(keysPressedCB_t appKeyCB)
{
  // Initialize KEY pins. Enable int after callback registered
  hKeyPins = PIN_open(&keyPins, keyPinsCfg);
  PIN_registerIntCb(hKeyPins, Board_keyCallback);
  PIN_setConfig(hKeyPins, PIN_BM_IRQ, PIN_MEM_INS | PIN_IRQ_NEGEDGE);

  PIN_setOutputValue(hKeyPins, PIN_MEM_TEST, 1);
  PIN_setOutputValue(hKeyPins, PIN_MEM_SEL, 1);

//    PIN_setConfig(hKeyPins, PIN_BM_IRQ, Board_BTN2        | PIN_IRQ_NEGEDGE);

  // Setup keycallback for keys
  Util_constructClock(&keyChangeClock, Board_keyChangeHandler,
                      KEY_DEBOUNCE_TIMEOUT, 0, false, 0);

  // Set the application callback
  appKeyChangeHandler = appKeyCB;
}

PIN_MEM_SEL, and PIN_MEM_TEST are defined as DIO8 and DIO7 in BOOSTXL_CC2650MA.h.

All the self-defined pins (PIN_MEM_*)  are also include in BoardGpioInitTable[]. The main function will call "PIN_init(BoardGpioInitTable)" to initial these pins.

My BoardGpioInitTable is defined as:

/*
 *  ========================= IO driver initialization =========================
 *  From main, PIN_init(BoardGpioInitTable) should be called to setup safe
 *  settings for this board.
 *  When a pin is allocated and then de-allocated, it will revert to the state
 *  configured in this table.
 */

/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(BoardGpioInitTable, ".const:BoardGpioInitTable")
#pragma DATA_SECTION(PINCC26XX_hwAttrs, ".const:PINCC26XX_hwAttrs")
#endif

PIN_Config BoardGpioInitTable[] = {                                           //
    PIN_MEM_INS | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS,
    PIN_MEM_REQ | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS,
    PIN_MEM_BZY | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS,
    PIN_MEM_SEL | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,
    PIN_MEM_TEST | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    PIN_TERMINATE};

const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
    //
    .intPriority = ~0,
    .swiPriority = 0
    //
};

I expect to see DIO8 and DIO7 pull high to 3.3V (which is my VDD), however, it seems like the two pins is floating (or maybe pull low). 

Any idea about this problem?

Thanks

  • Hi Alan,

    From my understanding, you are using the BOOSTXL-CC2650MA. Am I correct?

    - The jumper is required to control the IOs of the board

    - All the DIOs of the BOOSTXL-CC2650MA are not connected (so you should pick one that is connected - DIO13 for example).

    You can review the design files for more details.

    Kind regards,

  • Hi Clément,

    I solved this problem, however, I don't know why.

    I use default BoardGpioInitTable, that is, I did not include the pins I need,  and GPIO work well.

    const PIN_Config BoardGpioInitTable[] = {                                           //
        Board_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off             */
        Board_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off             */
        Board_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN,                                    /* UART RX  */
        Board_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,              /* UART TX */
        Board_SRDY | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL,                 /* SRDY */
        Board_MRDY | PIN_INPUT_EN | PIN_PULLDOWN,                                       /* MRDY */
        PIN_TERMINATE};
    

    All pins in BoardGpioInitTable are defined as "PIN_UNASSIGNED".

    Acording to TI "PIN.h File Reference", (http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/tirtos/2_14_03_28/exports/tirtos_full_2_14_03_28/docs/doxygen/html/_p_i_n_8h.html#a0de1df98a14e6e13b16db414e54472ef)

    PIN_init (const PIN_Config aPinCfg[] ) should include all the pins we want use.

    It says that "All pins not mentioned in aPinCfg[] are configured to be input/output/pull disabled."

    it seems like the documentation does not meet with my result.

    Do I have any misunderstanding about the documentation?

    Thanks.