Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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.

TMS320F280049C: SysConfig Tool not configuring GPIO pins correctly(?)

Part Number: TMS320F280049C
Other Parts Discussed in Thread: C2000WARE, SYSCONFIG

I am creating a CCS project for the F280049 microcontroller. CCS is version 11.0.0.00012 C2000Ware is version 4.00.00.00

I am using a .syscfg file for pin configuration.

I have tried two methods for creating the syscfg file:  The integrated sysconfig tool in CCS as well as the stand-alone sysconfig tool.  The problem that I am having occurs with both methods.

The  version of Sysconfig (both the integrated and stand-alone) is 1.10.0.2163

When you first create a new syscfg file, the creation dialog allows for optionally specifying a "Software Product".  One option for this is "C2000 sysconfig 3.01.00.00".  If a software product is specified, then the tool generates a .h and .c file with higher-level functions into C2000Ware.   If a "software product" is omitted, it is considered a "bare metal" project, and the tool generates .c and .h files with low-level (register) based routines to configure the pins. 

This is the problem that I have observed:

When I configure a GPIO pin (in this case a digital, push-pull output) and specify a "Software Product", the generated .c file init routines do not fully configure the GPIO pin(s).  They omit the disabling of "analog mode", even though the GPIO's were specified as digital in the designer.

These lines should be generated in the .c file, but they are not:

    GPIO_setAnalogMode(22U, GPIO_ANALOG_DISABLED);
    GPIO_setAnalogMode(23U, GPIO_ANALOG_DISABLED);

However, if I create the sysconfig project without specifying a software product (i.e. generate files for a bare metal application), the .c file created DOES include disabling of analog mode (the register equivalents of it.).

I am new to the sysconfig tool and may be missing something obvious, but this appears to be a bug.  Otherwise, I'd appreciate it if someone could explain what I am doing wrong.

The workaround is to manually insert the two lines shown above in main.c (or somewhere prior to utilizing the GPIO's).

  • First, I would always urge you to use the SOFTWARE PRODUCT version of the tool with a .c and .h file.

    The code it generates is correct. The DEFAULT state of those pins are DIGITAL so no need to write those lines of code.

    In fact in driverlib, GPIO_setAnalogMode only accepts a subset of pins. For your case, you should be fine with the code that gets generated.

    Nima

    The workaround is to manually insert the two lines shown above in main.c (or somewhere prior to utilizing the GPIO's).

    That is always an option to expand the SysConfig support if you see something you dont like.

    Also if you are new, try out these two docs:

    https://www.ti.com/lit/spracx3

    https://www.ti.com/lit/spry341

    Nima

  • Hi Nima,

    Thank you for your reply.  I do plan to use "Software Product" in my project.

    As you mention, when I go to add a GPIO, the "Analog Mode" pulldown menu is set to "Digital" (it is grayed out so that it cannot be changed).  That's fine.

    However, for some reason, in my main.c file, after I call Board_Init() (which is generated by sysconfig), setting values of the GPIO has no effect.  

    However, if I put the line GPIO_setAnalogMode(23U, GPIO_ANALOG_DISABLED); after I call Board_Init(), it works fine.  If I then comment it back out, the GPIO does not work.

         // *** The following does not work ***

         Board_init();

         GPIO_writePin(GPIO23_LED4, 0);
     

        / / *** The following does work ***

         Board_init();

        GPIO_setAnalogMode(23U, GPIO_ANALOG_DISABLED);

         GPIO_writePin(GPIO23_LED4, 0);

    The Board_init() routine generate by configsys is as follows.  Note that it does not specify analog/digital anywhere:

    void Board_init()
    {
        EALLOW;

        PinMux_init();
        GPIO_init();

        EDIS;
    }

    void PinMux_init()
    {
        // GPIO23_VSW -> GPIO23_LED4 Pinmux
        GPIO_setPinConfig(GPIO_23_GPIO23);
    }

    void GPIO_init(){
            
        //GPIO23_LED4 initialization
        GPIO_setDirectionMode(GPIO23_LED4, GPIO_DIR_MODE_OUT);
        GPIO_setPadConfig(GPIO23_LED4, GPIO_PIN_TYPE_STD);
        GPIO_setMasterCore(GPIO23_LED4, GPIO_CORE_CPU1);
        GPIO_setQualificationMode(GPIO23_LED4, GPIO_QUAL_SYNC);
        GPIO_writePin(GPIO23_LED4, 0);
    }

    I also noticed that the code example in my CCS/C2000Ware installation, which does not use sysconfig does use the GPI_setAnalogMode() routine.

    Thanks for your help.

  • I think you are correct about this. ONLY FOR GPIO23 and GPIO22 these lines are necessary.

    I will add this to the F28004x code generation templates as a special case

  • Hi Nima,

    Thanks for your help and attention to this!  Sorry I did not see that note, and maybe I should have read the documentation more thoroughly :-)   In any case, it's good to know this so that I know I'm not doing something wrong. 

    Regards,

    Eric

  • No youre doing the correct thing. I will acually add those lines of code to PinMux_init in the next C2000Ware version.