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.

LP-EM-CC2340R5: How do I change the GPIO pin configuration of my LED

Part Number: LP-EM-CC2340R5
Other Parts Discussed in Thread: CC2340R5, SYSCONFIG

Tool/software:

Hi, Ti

We use a self-designed board, and then the LED has changes on the pins. How do I change the pin of the LED? I can't find the configuration option to change the pin in syscfg.

I developed in the buttonled_LP_EM_CC2340R5_freertos_ticlang example.

Best regards

Preston

  • Hello Peisheng,

    Thanks for reaching out.

    You can take do this through SysConfig. Please take a look at the following screenshot.

    Hope this helps.

    David.

  • Hi, David

    I found that the options indicated in the image cannot be changed in the buttonled example, but can be changed in basic_ble example.

    buttonled example:

    basic_ble example:

    Here is the code in the buttonled example to get the handle and control the LED device after opening the device named CONFIG_LED_0. How is the device name CONFIG_LED_0 obtained? How do I control LED in basic_ble example? I want to control the LED to turn on, off and blink, but I don't know what the device name of the LED in the basic_ble example is.

        /* Open LED0 and LED1 with default params */
        LED_Params_init(&ledParams);
        ledHandle[CONFIG_LED_0] = LED_open(CONFIG_LED_0, &ledParams);
        ledHandle[CONFIG_LED_1] = LED_open(CONFIG_LED_1, &ledParams);

    Best regards

    Preston

  • Hello Preston,

    You have to modify them through the Button section in SysConfig.

    I see how this can be confusing. CONFIG_BUTTON_X and make CONFIG_LED_X make reference to hardware indexes specifying the
    configurations to be used to open the LED/BUTTON, you can find them defined inside ti_drivers_config.h (file generates/modified by SysConfig) and are part of the drivers definitions. CONFIG_BUTTON_0 is set to 0 and CONFIG_BUTTON_1 to 1 because the launchpad has a limited number of 2 buttons, same case for the LEDS. The CONFIG_BUTTON/LED_GPIO_xxx makes reference to the GPIO DIO itself.

    Let me know if this helps.

    BR,

    David.

  • Hi, David

    In the basic_ble example, there is no definition for CONFIG_LED_X in ti_drivers_config.h. Does that mean I need to manually add a definition for CONFIG_LED_X in ti_drivers_config.h? The following diagram shows ti_driver_config.h of the ble_basic example, without defining CONFIG_LED_X.

    I can't generate CONFIG_LED_X from syscfg because there is no option to add leds in syscfg (but there is an option to add a button, which is also my confusion).

    Please help me resolve these confusion.Thanks!

    Best regards

    Preston

  • Hello Preston,

    I understand the SysConfig in this specific example can let to confusions, as there is no LED driver interface enabled in it. However I think for the application you are describing, you can get away with just using the GPIO driver itself. I would suggest to take a look at this documentation: https://dev.ti.com/tirex/explore/node?devtools=LP-EM-CC2340R5&node=A__AORV2P9xKyaQCr.Dunw8Rg__com.ti.SIMPLELINK_LOWPOWER_F3_SDK__58mgN04__LATEST

    You can use functions like GPIO_write() or GPIO_toggle.

    Hope this helps.

    David.