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.

Compiler/LAUNCHXL-CC26X2R1: Controlling GPIO/Analog pins on LaunchPad to Supply 3.3V

Part Number: LAUNCHXL-CC26X2R1
Other Parts Discussed in Thread: CC2642R

Tool/software: TI C/C++ Compiler

I would like to trigger a GPIO pin on my CC26x2 LaunchPad. However, it seems like I am unable to do so. I am specifically looking at triggering the Analog pin DIO23. Ideally, I would like to supply 3.3V from the pin, but for now, I would just like to trigger the pin with any voltage.

Here is what I am doing:

GPIO_init();
GPIO_setConfig(Board_DIO23_ANALOG, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_write(Board_DIO23_ANALOG, Board_GPIO_LED_ON);

This code worked with triggering an on board LED. I measured the voltage on that pin and was able to detect 1.8V. However, when I run this with DIO32, it remains at 0. Am I doing something wrong here?

  • Hi,
    Try using the PIN_Config procedure listed in the pinStandby example of the SDK. Replace Board_PIN_LEDx with Board_DIO23_ANALOG.
    The example puts the device in standby and then toggles the LED associated pins after it wakes up.
  • //This didn't seem to work either. This is what I did:

    PIN_Config LedPinTable[] = { Board_DIO23_ANALOG | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ PIN_TERMINATE /* Terminate list */ }; static PIN_State pinState; static PIN_Handle hPin; static uint32_t currentOutputVal; hPin = PIN_open(&pinState, LedPinTable); currentOutputVal = PIN_getPortOutputValue(hPin); PIN_setPortOutputValue(hPin, ~currentOutputVal);

  • Actually I managed to get this working with PIN control. However, I believe it is sending a digital output. I would however like to send an analog output. How do I configure the pin to allow me to do that? Pin 23 has analog capabilities according to the documentation.
  • Bharathi Saravanabhavan said:
    I would however like to send an analog output.

    What differences do you expect between digital and analog output?

    Bharathi Saravanabhavan said:
    How do I configure the pin to allow me to do that?

    Which analog function do you need?

    Bharathi Saravanabhavan said:
    Pin 23 has analog capabilities according to the documentation.

    Analog capability does not mean analog output capability.
    For example, if you use DIO23 for ADC, it would be an input.
    However, if you use an analog capable PIN for a DAC function, it would be an output.

    Picture below shows Analog Peripheral Modules for you CC2642R module:

    More about analog functions you can find within this document: www.ti.com/.../swcu185a.pdf
    Chapter 19.5 Analog Peripheral Modules.

  • Hi,

    Basically all I'd like to do is change the voltage coming from the pin. Right out when the value is set to high, I am outputting 3.3 volts. However, I'm not able to produce enough current to power my peripheral device. So what I'd like to do is lower the voltage so I can increase the current delivered to the peripheral. Is there an effective way to do that with software?

    I know I can build a voltage comparator or transistor circuit, but I wanted to try this with software before doing that.

  • Hi,

    there are 5 GPIOs capable to deliver 8 mA. Not enough?
    CC2642R has DAC, please check its current capabilities.
    I do not expect it can deliver 8 mA, however it lets you control an output voltage.
  • Great I'll try using the DAC. Is there a code example on it's implementation?
  • I do not know any DAC examples for CC26x2 MCUs.
    Please mark this thread as resolved and post new one related to your DAC question.