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.

CC1312R: Unable to modify value of GPIOs in CC1312R

Part Number: CC1312R

Hello,

         I am using SPI interface of CC1312R in my project. For chip select , I am trying to change the value of chip select GPIO from high to low, but the GPIO value is not changing.

         For verifying , I loaded gpiointerrupt project from TI explorer, here though I was able to change the state of LED, when I changed the GPIO in the project like DIO1 or DIO22 , the GPIO value was not changing.

        Other configurations of GPIOs are the same. Kindly let me know if more information is required. 

Regards,

Omkar

  • Did you do a GPIO_setConfig() on the pin?

    Please provide the changes you have done to the code?
  • Hello TER,

                     Yes, I have done GPIO_setConfig() on the pin. I did following changes in the gpiointerrupt project :

     /* Configure the LED and button pins */
        GPIO_setConfig(IOID_22, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(Board_GPIO_LED1, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        //GPIO_setConfig(Board_GPIO_BUTTON0, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);
    
        /* Turn on user LED */
        GPIO_write(IOID_22, Board_GPIO_LED_ON);
        GPIO_write(IOID_22, Board_GPIO_LED_OFF);

    By putting breakpoints on above statements ,where I am changing values of IOID_22, I am measuring voltage on DIO22 on LAUNCHXL-CC1312R1 . There is no change in the voltage level of DIO22. It is staying at 0.

    Kindly suggest whether I am unaware of any more configs.

    Regards,

    Omkar

  • It was a couple of thing I wasn't aware of:

    In the CC1312R1_KAUNCHXL.c file you have the following table:

    GPIO_PinConfig gpioPinConfigs[] = {
        /* Input pins */
        GPIOCC26XX_DIO_13 | GPIO_DO_NOT_CONFIG,  /* Button 0 */
        GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG,  /* Button 1 */
    
        GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG,  /* CC1312R1_LAUNCHXL_SPI_MASTER_READY */
        GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG,  /* CC1312R1_LAUNCHXL_SPI_SLAVE_READY */
    
        /* Output pins */
        GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG,  /* Green LED */
        GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG,  /* Red LED */
    
        /* SPI Flash CSN */
        GPIOCC26XX_DIO_20 | GPIO_DO_NOT_CONFIG,
    
        /* SD CS */
        GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG,
    
        /* Sharp Display - GPIO configurations will be done in the Display files */
        GPIOCC26XX_DIO_24 | GPIO_DO_NOT_CONFIG, /* SPI chip select */
        GPIOCC26XX_DIO_22 | GPIO_DO_NOT_CONFIG, /* LCD power control */
        GPIOCC26XX_DIO_23 | GPIO_DO_NOT_CONFIG, /*LCD enable */
    
    };

    The the corresponding .h file you have the following table:

    typedef enum CC1312R1_LAUNCHXL_GPIOName {
        CC1312R1_LAUNCHXL_GPIO_S1 = 0,
        CC1312R1_LAUNCHXL_GPIO_S2,
        CC1312R1_LAUNCHXL_SPI_MASTER_READY,
        CC1312R1_LAUNCHXL_SPI_SLAVE_READY,
        CC1312R1_LAUNCHXL_GPIO_LED_GREEN,
        CC1312R1_LAUNCHXL_GPIO_LED_RED,
        CC1312R1_LAUNCHXL_GPIO_SPI_FLASH_CS,
        CC1312R1_LAUNCHXL_SDSPI_CS,
        CC1312R1_LAUNCHXL_GPIO_LCD_CS,
        CC1312R1_LAUNCHXL_GPIO_LCD_POWER,
        CC1312R1_LAUNCHXL_GPIO_LCD_ENABLE,
        CC1312R1_LAUNCHXL_GPIOCOUNT
    } CC1312R1_LAUNCHXL_GPIOName;

    Since The GPIO driver uses indexes you have have to use the name that correspond with the DIO you want to use. 

    Here GPIOCC26XX_DIO_22 maps to CC1312R1_LAUNCHXL_GPIO_LCD_POWER and it's this name you have to use in the code:

    GPIO_setConfig(CC1312R1_LAUNCHXL_GPIO_LCD_POWER, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);

  • Hello TER,
    I did as you suggested, now it is working fine. So, I assume that if I have to use GPIOs other than mentioned in the above tables, I'll have to include them in the same order. Please correct me if I am misunderstood it.

    Thanks & Regards,
    Omkar
  • Correct, since it's based on a index you have to list them in the same order.
  • Hello TER,

    Thank you for your answer!

    Regards,
    Omkar