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: Reset I2C port configuration

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

Using: simplelink_cc32xx_sdk_1_50_00_06

After using i2C for temperature mesurement, I want to use ports GPIOCC32XX_GPIO_10 ("LED1") and GPIOCC32XX_GPIO_11 ("LED2") again as GPIO output ports.
(LEDs are enabled in GPIO_PinConfig gpioPinConfigs[] in CC3220SF_LAUNCHXL.c and CC3220SF_LAUNCHXL.h)

Functional sequence::
1. GPIO_init()
Some code using all 3 Board LED's:  works OK
2. I2C_init()
Some code accessing temerature sensor: works OK
3. I2C_close()

Ports GPIO10 and GPIO11 remain high and can not be set again by GPIO_init()  and GPIO_write()

How can I release multiplexer setting from I2C_SCL and I2C_SDA to GPIO function again? (I would prefer using driver functions instead of directly manipulating registers)

Thanks for any proposal!

Klaus 


After adapting GPIO_PinConfig gpioPinConfigs[] in CC3220SF_LAUNCHXL.c and CC3220SF_LAUNCHXL.h

  • Hi Klaus,

    You can use the GPIO_setConfig() API in GPIO.h to dynamically configure a GPIO pin. There is not an equivalent for I2C, but I tested this reusing I2C_init() with no issue.

    Best regards,
    Sarah
  • Hi Sarah

    Thanks for replying.

    Reconfiguring from I2C to general GPIO by re-launching GPIO_init() does not work. Outputs GPIO10 and GPIO11 remain high after reconfiguring. The reason is not clear to me.

    Here is, how it works according to Sarah's reply:

    GPIO_setConfig(Board_GPIO_LED1, GPIOCC32XX_GPIO_10 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW);
    GPIO_setConfig(Board_GPIO_LED2, GPIOCC32XX_GPIO_11 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW);

    Remarks:

    1. Files CC3220SF_LAUNCHXL.c and CC3220SF_LAUNCHXL.h:
    gpioPinConfigs[] must contain  GPIOCC32XX_GPIO_10 and GPIOCC32XX_GPIO_11  

    2. File Board.h: (LED_D5 and LED_D6 are in reality D8 and D9 on the CC3220SF_LaunchXL board)
    #define Board_GPIO_LED1 CC3220SF_LAUNCHXL_GPIO_LED_D5 // changed (from D7) 
    #define Board_GPIO_LED2 CC3220SF_LAUNCHXL_GPIO_LED_D6 // changed (from D7) 

    3. GPIO_10 and GPIO_11 can be set as digital GPIO, even if used as I2C pins. I2C ports are reconfigured by calling I2C_init().

    Best Regards
    Klaus

  • Klaus and Sarah,

    I have the same need -- to operate GPIO10&11's LEDs again after using them for I2C. My GPIO_writes to LED1 and LED2 worked perfectly before using them for I2C.

    After I'm done I2Cing (to the onboard BMA222 for purposes of this test), I'm calling I2C_close, then, per Sarah's recommendation, I2C_init. Thereafter, my calls to GPIO_write to turn off LED1 and LED2 are executed with no visible effect -- both LEDs remain on.

    I even tried adding calls to Board_initGeneral (again), (then i2C_init again as suggested), and GPIO_init (again) with NO CHANGE. It seems that once these two GPIOs are used for I2C, they are "forever I2C." Why?

    I'm using the CC3320LAUNCHXL board under SDK 1.5 with CCS 7.3 -- all the latest-and-greatest.

  • Hi Ralph,

    You can get back the GPIO functionality after using i2C with the following statements:

    GPIO_setConfig(Board_GPIO_LED1, GPIOCC32XX_GPIO_10 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW);
    GPIO_setConfig(Board_GPIO_LED2, GPIOCC32XX_GPIO_11 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW);

    Hope this helps

    Klaus

  • Klaus,

    OK, that appears to work!

    So ... when I want to go back to I2Cing again, I just call I2C_open again, right?

    Due to the limited number of available pins which can be used to awaken the MCU, I'm thinking of using this method to make GPIO11 available for another sensor INT signal to tell the MCU to wake up.

    I'm already using GPIOs 4 and 13 for INT wakeups. GPIO2 multiplexes with UART-RX and GPIO17 multiplexers with SPI-CS.

    My sensors are on I2C and I'm using SPI (with a port expander) to get more outputs.

    Is this what you're trying to do also -- use GPIO11 for input when not I2Cing?

    Ralph