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.

RTOS/CC1310: API to change the status of GPIO in ti154stack sensor example application

Part Number: CC1310

Tool/software: TI-RTOS

Hello,

We want to write 1/0 to  gpio  pin with ti154stack sensor example application I'm using the API GPIO_write() but the GPIO status is not changing and i also used Board_Gpio_control(Board_GPIO_DIO13,0); API but not working 

How to change the status/toggle the GPIO in ti154stack sensor application?

Thanks&Regards,

shilpa 

  • You can refer to how it controls LED and do the same to your GPO pin.
  • Hello Shilpa,

    You have multiple ways of doing this.

    1. You can use our Board_gpio driver which are implemented using the GPIO drivers. (make sure you understand how the drivers work, and where to add the GPIO pin you wish to add.)
    2. Using the GPIO drivers directly. (You have to make sure to add the pins you wish to control in the driver init files <LAUNCHXL.x and Board.h>
    3.You can use the PIN drivers (easiest and most straight forward way, but you will be ignoring the abstraction layers we have provided for you)

    From the looks of what you are doing, it seems to me that you are using the APIs correctly but you have not modified the drivers to be able to use those pins that you want to contol. Also gpIo 13 is already being used by the application as Btn 1.

    Regards,
    AB
  • Hello AB,

    I added PIN in LAUNCHXL.h and Board.h,it is working with nortos examples, now I'm trying with ti154stack sensor application with same modification but not working.

    I'm working with our custom board so gpio13 is not used for Buttons

    Board_Gpio_control(Board_GPIO_DIO13,0) this is the right API right?

    Thanks&Regards,

    shilpa 

  • You should make sure you call PIN_init/PIN_open with your gpio13 configuration and then you can use PIN_setOutputValue to change high/low status of gpio 13.
  • Shilpa,

    If you want DIO 13 to be controlled as a output GPIO, you will have to add GPIO13 to the GPIOPINTABLE array in board_gpio.c and add an if statement to handle the controlling of this pin in the board_gpio_control API.  

    You will also have to replace/remove the DIO13 value from the BTTON definition/macro on the board.h file.

    The way we have it with these abstraction layers in between is to maintain clear abstraction layers and handle the HWI calls and make sure we dont fall in an unknown state. You can always just write directly to the PIN register from anywhere in the code. But the way I described up in the top is the way to go.

    Regards,

    AB

  • Hi AB,

    I did below changes in the code, still it is not working, can u check what I'm missing

    1. I tried to toggle IOID_24, so index is 8  gpioPinConfigs[]  in CC1312R1_LAUNCHXL.c and for index 8  CC1312R1_LAUNCHXL_GPIO_LCD_CS is the GPIOName

    2. Defined in Board.h #define Board_TEST_GPIO         CC1312R1_LAUNCHXL_GPIO_LCD_CS

    3. In board_gpio.h , added below enum for board_gpio_type

    #if defined(Board_TEST_GPIO)
    board_test_gpio,

    #endif

    4. In board_gpio.c Board_Gpio_control(), added below code

    static PIN_Config gpioPinTable[] =
    {
    Board_TEST_GPIO | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,

    PIN_TERMINATE /* Terminate list */
    };

    #if defined(Board_TEST_GPIO)
    if (gpio == board_test_gpio)
    {
    key = HwiP_disable();
    PIN_setOutputValue(gpioPinHandle, Board_TEST_GPIO, value);
    HwiP_restore(key);
    return;
    }

    #endif 

    5.In sensor.c added below to change the state of the DIO

    for(i=0;i<2;i++){
    LCD_WRITE_STRING("GPIO Toggling",6);
    Board_Gpio_control(board_test_gpio,1);
    Task_sleep(10000);
    Board_Gpio_control(board_test_gpio,0);
    }

    And i commented IOID_24 related other code in CC1312R1_LAUNCHXL.c & .h

     GPIO state is not changing

    Regards,

    shilpa

  • Hello Shilpa,

    We are moving the right direction.

    In step 4, did you add that PIN config inside the function? or did you just add "Board_TEST_GPIO | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX," inside the existing GPIO config array? It should just be an addition to the existing pin config array at the top of the file.

    Make sure to also add the test board macro verification (include it as a OR(||) in addition to the other two) into the first #if located in the GPIO_control function, if not it will return null every time.

    With those few changes it should work!

    Regards,
    AB
  • Hello AB,

    Thanks for the support

    I couldn't able to change the gpio state even after doing the above but I could able to change the state of GPIO using GPIO_write() 

    Thanks&Regards,

    shilpa