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.

CC3220S-LAUNCHXL: How to drive a GPIO

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

Hi,

I want to drive GPIO 03 within oob example. I did the following:

1. add the following line in CC3220S_LAUNCHXL.c gpioPinConfigs[]

GPIOCC32XX_GPIO_03 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW, // added by david

2. add the following line in main program

#include <ti/drivers/gpio/GPIOCC32XX.h> // added by david    

GPIO_write(GPIOCC32XX_GPIO_03, 0xFF); //added by david

This doesn't work. Can you advise what my steps should be in order to drive a GPIO 03 to 1?

Thanks,

David

  • David,

    You must also initialize this pin in the enum, CC3220S_LAUNCHXL_GPIOName, (line 91) of CC3220S_LAUNCHXL.h. Make sure the order in this enum corresponds to gpioPinConfigs in CC3220S_LAUNCHXL.c.

    Please click “This resolved my issue”  button if the answer provided resolved your issue.

    Regards,

    Seong

  • Hi Seong,

    Thank you for feedback. I added the pin to the enum but unfortunately it didn't work. I did debug, it just steps into the GPIO_Write command and hangs on the following step inside GPIOCC32XX.c:

        MAP_GPIOPinWrite(getPortBase(config->port), config->pin, output);

    The LED that I connected to the GPIO didn't turn on. Do you know how I can monitor the actual register contents for the GPIO_03 while debugging in CCS?

    Thanks,

    David

  • David,

    CCS has several views to assist with debugging like Expressions view, Register view, etc. Using either one of these, you'll be able to see the value of specific GPIO registers. 

    Also, the first parameter of GPIO_Write() should be what you wrote in the enum.

    Regards,

    Seong

  • Seong,

    Thank you for reply. Could you be more specific as to how the GPIO_03 register could be added to monitor list. A step by step instruction would be helpful. 

    Any clues why "MAP_GPIOPinWrite(getPortBase(config->port), config->pin, output);" causes a hang during debug? I tried looking at (0x4402) address in the memory (if I am not mistaken, it's the config address for GPIO_3, correct?)  before the hang and it shows B990. Per the cc3220 datasheet document, is the expected value E0AC? Since the mentioned hang I am not able to see it changed.

    Thanks again for support.

    David

  • David,

    I see why you might have been having trouble with the expressions/registers tab because there are no CCS peripheral register definitions for the CC3220 yet.

    Additionally, I suggest that you choose to experiment with a GPIO other than GPIO 3. The reason why I say this is because GPIO 3 is not routed to Pin 2 of Header, P1, as the 0 ohm resistors connecting the path are depopulated by default (image from schematic shown below). 

    This was intentionally done so that GPIO3 could be used as an ADC input by default, routing it to pin 5 of header, P3 through the OpAmp. 

    Unless you are able to solder the necessary resistors shown above to use pin2, try toggling another GPIO that is routed to a pin on the LaunchPad. For example, follow these instructions to toggle GPIO13 (pin 3 of header P1) high:

    1. Add the following line where you want to toggle GPIO13 high

    GPIO_write(Board_GPIO_13, 1);

    2. Add the following in Board.h

    #define Board_GPIO_13                CC3220S_LAUNCHXL_GPIO_13

    3. Add the following in the enum, CC3220S_LAUNCHXL_GPIOName of CC3220S_LAUNCHXL.h

    CC3220S_LAUNCHXL_GPIO_13,

    4. Add the following in gpioPinConfigs[] of CC3220S_LAUNCHXL.c

    GPIOCC32XX_GPIO_13 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,

    Hope this helps,

    Seong

  • Hi Seong,

    Thanks for great explanation. The GPIO_13 seemed to be in use in oob example therefore I used GPIO_14:

    GPIO_PinConfig gpioPinConfigs[] = {
    /* input pins with callbacks */
    /* CC3220S_LAUNCHXL_GPIO_SW2 */
    GPIOCC32XX_GPIO_22 | GPIO_CFG_INPUT | GPIO_CFG_IN_INT_RISING,
    /* CC3220S_LAUNCHXL_GPIO_SW3 */
    GPIOCC32XX_GPIO_13 | GPIO_CFG_INPUT | GPIO_CFG_IN_INT_RISING,

    /* output pins */
    /* CC3220S_LAUNCHXL_GPIO_LED_D7 */
    GPIOCC32XX_GPIO_09 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    GPIOCC32XX_GPIO_14 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW, // added by david

    It worked, but I will write a more detailed post soon to ask help for another issue that I just encountered.

    Thanks,
    David
  • That's great! Glad you got it to work.

    I'm going to close this thread. Please post a new thread if it is an unrelated issue. 

    Best Regards,

    Seong