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.

[FAQ] CC2642R: How to rename PIN instance in SysConfig?

Part Number: CC2642R
Other Parts Discussed in Thread: SYSCONFIG

SysConfig GUI only allows to change the name of the GPIO, not the name of the associated PIN. However for project using the PIN driver it maybe be best to give meaningful name to the PINs.

 Here is a fairly workaround to do this:

  1. Using SysConfig GUI, create the GPIO you need.
  2. Once done, save an close the file.
  3. Open the .syscfg file with a text editor (you can use CCS' text editor)
  4. Find the GPIO corresponding to the PIN you want to rename. To find easily the GPIO, you can search for the exact GPIO name you have set in SysConfig.
  5. Once you have found the proper GPIO, rename its corresponding pinInstance.$name.
  6. Save the file

I have tested this with simple_peripheral example and I have added support for the red LED of the LaunchPad. In SysConfig GUI, I have called the GPIO “CLEMENT_SIN_LED”. Then I have opened the .syscfg file and found that SysConfig the corresponding GPIO instance is called GPIO3 by SysConfig. So I change the value of  GPIO3.pinInstance.$name to what I wanted.

 

GPIO3.$name             = "CLEMENT_SIN_LED";
GPIO3.$hardware         = system.deviceData.board.components.LED_RED;
GPIO3.pinInstance.$name = "CLEMENT_SIN_LED_PIN";

 After this, you can use the chosen PIN name in your code. Here some extracts of the code I have added in simple_peripheral.c:

#include <ti/drivers/PIN.h>

PIN_Config ledPinTable[] = {
    CLEMENT_SIN_LED_PIN | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    PIN_TERMINATE
};

static PIN_Handle ledPinHandle;
static PIN_State ledPinState;

static void SimplePeripheral_init(void)
{
  //...
  ledPinHandle = PIN_open(&ledPinState, ledPinTable);
  //...
}

static void SimplePeripheral_toggleClementLed(void)
{
    uint32_t currVal = 0;
    currVal =  PIN_getOutputValue(CLEMENT_SIN_LED_PIN);
    PIN_setOutputValue(ledPinHandle, CLEMENT_SIN_LED_PIN, !currVal);
}

I hope this will help,

Best regards,