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.

How to change LED's status as active low in ti_drivers_config?

Other Parts Discussed in Thread: SYSCONFIG, CC1312R

Hello Sir/Madam,

I use custom board based CC1312R1. The ti_drivers_config.h file is generaed as soon as configured the GPIOs on sysconfig and build the project. When I checked ti_drivers_config.h file I saw that the LEDs status is active high. How can I change it?

The LED configuration in sysconfig and generaed file ti_drivers_config.h part can be seen below.

  • Hi,

    Have you tried setting the "Initial Output State" to Low in SysConfig?

    Regards,

    Arthur

  • Hello Arthur,

    I tried it and LEDs are starting to work at on state. But I want them to start off state and change their state with GPIO_write function.

    By the way when I want to change the state with command GPIO_write(CONFIG_GPIO_LED_RED, CONFIG_GPIO_LED_ON); the LED off.

    Also I tried invert option in sysconfig but can not fit into my usage.

    Regards,

    Veli Can

  • Hi Veli,

    Can you show me how the LEDs are wired on your board?

    Regards,

    Arthur

  • Hi Arthur,

    It is like that. RGB_R is DIO38, RGB_B is DIO39 and RGB_G is DIO40.

    Regards,

    Veli Can

  • Hi,

    I see, pins 38, 39 and 40 actually mean DIO_25, DIO_26 and DIO_27, as per table 7.1 of the CC1312R datasheet.
    By the way, I think the current sink from the LEDs is too high.

    The technical reference manual for that device states (table 13-2) that those pins can drive a maximum of 4mA.

    If you want to try the pin initialization to high, here is a modification of the empty project.

    /*
     * Copyright (c) 2015-2019, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ======== empty.c ========
     */
    
    /* For usleep() */
    #include <unistd.h>
    #include <stdint.h>
    #include <stddef.h>
    
    /* Driver Header files */
    #include <ti/drivers/GPIO.h>
    // #include <ti/drivers/I2C.h>
    // #include <ti/drivers/SPI.h>
    // #include <ti/drivers/Watchdog.h>
    
    /* Driver configuration */
    #include "ti_drivers_config.h"
    
    /*
     *  ======== mainThread ========
     */
    void *mainThread(void *arg0)
    {
        /* 1 second delay */
        uint32_t time = 1;
    
        /* Call driver init functions */
        GPIO_init();
        // I2C_init();
        // SPI_init();
        // Watchdog_init();
    
        /* Configure the LED pin */
        //GPIO_setConfig(CONFIG_GPIO_LED_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    
        /* Turn on user LED */
        //GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
    
        while (1)
        {
            sleep(time);
            //GPIO_toggle(CONFIG_GPIO_LED_0);
        }
    }
    

    with the following SysConfig:

    You will find that the pin starts on the HIGH state.

    Regards,

    Arthur

  • Hi Arthur, 

    Thanks your suggestions. I solved the problem by using LED driver instead of GPIO. 

    The initial state is low and value inversion is enabled and the problem solved.

    Thank you so much.

    Regards,

    Veli Can