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.

SIMPLELINK-CC2640R2-SDK: How to edit the Simplelink SDK as to change the functionality of pins

Part Number: SIMPLELINK-CC2640R2-SDK

Tool/software:

We are editing an existing custom PCB that uses a CC2640R2-RGZ MCU from TI as and the Simplelink SDK (version 5.10.00.02). We have attempted to change some of the pin configurations in the board.h, board.c and launch files in the SDK, but it doesn't seem to work when we rebuild and flash the code in Code Composer Studio. Any suggestions on how to edit the pins?

  • Hello Jordan, 

    What GPIOs are you looking to alter? 

    To assign GPIOs, please follow the steps below: 

    1. Within board.h, define the desired GPIO. 

    Fullscreen
    1
    #define Board_DIO21 CC2640R2_LAUNCHXL_DIO21
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    2. Define the CC2640R2_LAUNCHXL_DIO21 within CC2640R2_LAUNCHXL.h. 

    Fullscreen
    1
    #define CC2640R2_LAUNCHXL_DIO21 IOID_21
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    3. If you are using the for standard digital GPIO, (DIO), then you can add the code below to test: 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #include <ti/drivers/GPIO.h>
    #include <ti/devices/cc26x0r2/driverlib/ioc.h>
    /* Board Header file */
    #include "Board.h"
    /*
    * ======== mainThread ========
    */
    void *mainThread(void *arg0)
    {
    /* 1 second delay */
    uint32_t time = 1;
    /* Call driver init functions */
    GPIO_init();
    /* Configure GPIO to output, and starts low */
    GPIO_setConfig(Board_DIO21, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    /* Additional IO configuration for GPIO output */
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Let me know if this helps! 

    Thanks, 

    Isaac

  • Within the board.h specifically I am trying to change pins 6 and 7 to match pins 12 and 15. In CC2640R2_LAUNCHXL.h they are set as the PIN_RLEG and GLED: 

    #define CC2640R2_LAUNCHXL_DIO12                 IOID_12
    #define CC2640R2_LAUNCHXL_DIO15                 IOID_15
    #define CC2640R2_LAUNCHXL_PIN_RLED              IOID_6
    #define CC2640R2_LAUNCHXL_PIN_GLED              IOID_7
     
    I also want to use pins 13 and 14 to replace what pins 6 and 7 used to be doing:
    #define CC2640R2_LAUNCHXL_PIN_BTN1              IOID_13
    #define CC2640R2_LAUNCHXL_PIN_BTN2              IOID_14
    These all come from the untouched files for the SDK
  • Hello Jordan, 

    Can you clarify what you mean by match pins 12 and 15? For example, do you want GPIO 6 to toggle when GPIO 12 is toggled? 

    To do this, alter the IOID_xx to the desired GPIO output within CC2640R2_LAUNCHXL.h. I would then recommend changing the CC2640R2_LAUNCHXL_xxx name to the DIO #. After this, alter the board.h file to represent the new DIO name. For example: 

    CC2640R2_LAUNCHXL.h

    Fullscreen
    1
    2
    //#define CC2640R2_LAUNCHXL_PIN_BTN1 IOID_13 //OLD
    #define CC2640R2_LAUNCHXL_DIO13 IOID_13 //Updated
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Board.h

    Fullscreen
    1
    2
    3
    4
    //#define Board_PIN_BUTTON0 CC2640R2_LAUNCHXL_PIN_BTN1 //Old
    //#define Board_PIN_BTN1 CC2640R2_LAUNCHXL_PIN_BTN1 //Old
    #define Board_DIO13 CC2640R2_LAUNCHXL_DIO13 //NEW
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Additionally, run a search on your project to verify the desired pins are not being initialized/assigned somewhere else. You can do this by toggling ctrl+h, and looking up the IOID_# value within File Search. 

    Let me know if this helps. 

    Thanks, 
    Isaac

  • Sorry that wasn't clear, simply we want pins 6 and 7 to match pins 12 and 15 in functionality. We previously had one multiplexer on our custom PCB, and we recently added a second. Pins 12 and 15 are on the original component, 6 and 7 will do the same functionality but on the newly added mux

  • Hello Jordan, 

    I appreciate your patience. 

    Unfortunately, the GPIO/Pin drivers do not offer a pin muxing API. Please refer to the PIN_setPortOutputValue function. The function can simultaneously toggle GPIOs via a buffer. Also, please refer to the E2E thread linked. 

    Let me know if this helps!

    Thanks, 

    Isaac