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.

CC3220SF-LAUNCHXL: Unable to GPIO_read from some pins

Part Number: CC3220SF-LAUNCHXL
Other Parts Discussed in Thread: CC3220SF

Hi there,

I'm new to TI products. Thanks for you to support so much of reference and helps.

I would like to set some of my GPIOs as INPUT, but it seems like some of them failed.

For example, these are what I set in CC3220SF_LAUNCHXL.c and .h:

GPIO_PinConfig gpioPinConfigs[] = {

    /* for set device */
    /* GPIO_DEVICE_0, pin63*/
    GPIOCC32XX_GPIO_08 | GPIO_CFG_INPUT | GPIO_CFG_IN_INT_BOTH_EDGES,
    /* GPIO_DEVICE_1, pin 53*/
    GPIOCC32XX_GPIO_30 | GPIO_CFG_INPUT | GPIO_CFG_IN_INT_BOTH_EDGES,
    /* GPIO_DEVICE_2, pin 50*/
    GPIOCC32XX_GPIO_00 | GPIO_CFG_INPUT | GPIO_CFG_IN_INT_BOTH_EDGES,

...

};

GPIO_CallbackFxn gpioCallbackFunctions[] = {
    NULL,  /* GPIO_DEVICE_0 */
    NULL,  /* GPIO_DEVICE_1 */
    NULL,  /* GPIO_DEVICE_2 */
...
};

typedef enum CC3220SF_LAUNCHXL_GPIOName {

    /* for read device */
    GPIO_DEVICE_0,
    GPIO_DEVICE_1,
    GPIO_DEVICE_2,

    ...

    CC3220SF_LAUNCHXL_GPIOCOUNT
} CC3220SF_LAUNCHXL_GPIOName;

When the pins are connected, only GPIO_DEVICE1 and 2 can read the signals. DEVICE_0 seems not read anything, and its interrupt callback doesn't work neither.
(It can do GPIO_write so... I suppose the GPIO mapping is correct?)

It also happens with some other pins as I trying to figure out which of them can be set to input successfully, even with some of them are said to have GPIO as primary function. (such as pin 45, GPIO_31)

Is there anything I missed for the set-up or any suggestion way how I can check for this? 

Thank you.

  • Hi syh,

    Can you share the code you are using to initialize and read the GPIOs? Can you share how you enable the interrupt and your GPIO interrupt callback?

    Best regards,

    Sarah

  • Hi Sarah,

    Thanks for your reply.

    In the main thread, I first make an initial function to initial UART and GPIOs, and then read the GPIOs for the first time with GPIO_read().

    After that, I set the GPIO callbacks with GPIO_setCallback  (the gpioCallbackFunctions is all NULL as in the previous post) and call GPIO_enableInt() to initial them.

    All the 3 pins share similar codes of GPIO operation.

    The code looks like the following :

    void driver_init(void) {
       
        GPIO_init();
        UART_init();
        ADC_init();
    
        // ... do some UART setting
    }
    
    uint8_t readDevice(){
    
        uint_fast8_t bit0 = GPIO_read(GPIO_DEVICE_0);
        uint_fast8_t bit1 = GPIO_read(GPIO_DEVICE_1);
        uint_fast8_t bit2 = GPIO_read(GPIO_DEVICE_2);
        return (bit0 | (bit1) << 1 | (bit2) << 2) ;
    }
    
    void deviceChange0(uint_least8_t index){
    
        uint_fast8_t bit0 = GPIO_read(index);
        ...
    }
    
    void *mainThread(void *arg0)
    {
    
      driver_init();
      Timer_init();
    
      // ... some timer work
    
      device_sig = readDevice();
    
      // ... some work
    
      GPIO_setCallback(GPIO_DEVICE_0, deviceChange0);
      GPIO_enableInt(GPIO_DEVICE_0);
      GPIO_setCallback(GPIO_DEVICE_1, deviceChange1);
      GPIO_enableInt(GPIO_DEVICE_1);
      GPIO_setCallback(GPIO_DEVICE_2, deviceChange2);
      GPIO_enableInt(GPIO_DEVICE_2);
    
      ...
    }

    BTW, I've tried to change the pin assignment to test the code : set GPIO_DEVICE_0 to GPIO_30 (which is originally set as GPIO_DEVICE_1), and GPIO_DEVICE_1 to GPIO_08, and it turned out GPIO_30 CAN still work while GPIO_08 still CAN'T.

    Thank you.


    ---- Update ----

    Don't know if it help but I tried to test the INPUT setting to all the pins except the LEDs and UARTs :

    GPIO PIN Result
    00 50 O
    01 55 UART
    02 57 UART
    03 58 X
    04 59 X
    05 60 X
    06 61 O
    07 62 O
    08 63 X
    09 64 LED
    10 1 LED
    11 2 LED
    12 3 O
    13 4 O
    14 5 O
    15 6 O
    16 7 UART
    17 8 UART
    22 15 O
    23 16 CRASH*
    24 17 CRASH*
    25 21 X
    28 18 O
    30 53 O
    31 45 X

    (*) Got a DAP access error when doing GPIO_INIT with GPIO_23, 24.

  • Hi syh,

    • The LaunchPad headers for pins 57-60 are not expected to work as GPIOs by default due to the surrounding LaunchPad hardware designed to protect ADC inputs. See the schematics in the LaunchPad hardware design files.
    • Pins 16 and 17 (TDI and TDO) cannot be configured while the device is in 4-wire JTAG mode.
    • Pin 21 is SOP2
    • Pin 45 has a note on how to use this pin in the datasheet.

    Pin 63 is the only pin that I do not expect an issue. Are you using a timer capture in your application?

    Best regards,

    Sarah

  • Hi Sarah,

    Thanks for your reply. I realized I got some misunderstanding with the GPIO usages in the launchpad user guide.

    For the pin 63, yes I do have a timer in the current working program. But I also tested it with a simple program in which nothing else but only GPIO is initialed (just like that in the SDK sample gpiointerrupt project).

    Thank you.

  • Hi syh,

    I tested the gpiointerrupt example with pin 63 and everything worked as expected. The GPIO interrupt should work in any SDK version, but I tested with the latest CC32xx SDK 4.30.

    I saw on your other thread that you are experiencing hardware issues with your LaunchPad. If you get a replacement LaunchPad, can you try this again?

    Best regards,

    Sarah

  • Hi Sarah,

    OK so this may get some connection with the hardware issue... Anyway I'm getting a new board now.

    Thanks for your replies. They really help a lot : )

    --- Update ---

    Got another board and this time pin 63 can be read successfully.

    So the original problem might be a sign of the board damaged issue...