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.

CCS/TMS320F2802: GPIO with controlSUITE

Part Number: TMS320F2802
Other Parts Discussed in Thread: CONTROLSUITE, , ENERGIA, C2000-GANG

Tool/software: Code Composer Studio

Hi everybody,

I am new to CCS and I need to program TMS320F28026 microcontroller. For this task, I need to use controlSUITE Software Driver Model because I don't have time for Direct Register Access. The first thing I want to do is simply control a GPIO pin as General Purpose mode. I referred to controlSUITE example "gpio_setup" and to "spruhx9" F2802x Peripheral Driver Library user's guide to make a first sketch shown below:

#include "DSP28x_Project.h"
#include <gpio.h>

GPIO_Handle myGpio;

int main(void) {

    myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj));
    GPIO_setDirection(myGpio, GPIO_Number_3, GPIO_Direction_Output);
    GPIO_setMode(myGpio, GPIO_Number_3, GPIO_3_Mode_GeneralPurpose);
    GPIO_setHigh(myGpio, GPIO_Number_3);
    GPIO_setPullUp(myGpio, GPIO_Number_3, GPIO_PullUp_Enable);
    GPIO_setQualification(myGpio, GPIO_Number_3, GPIO_Qual_ASync);

    return 0;
}

GPIO3 doesn't go high.

No errors, no warnings. Everything seems to be right at compilation.

I use CCS 6.2.0, TI v15.12.3.LTS compiler, and C2000-GANG programmer. Before using controlSUITE, I tried Energia library and GPIO and other peripherals were working fine.

Is my code correct? Should I do modifications in controlSUITE library to make this work?

Regards,

Sébastien

  • Sebastien,

    Have you tried running the example code without any modifications, and seeing if GPIO6 and GPIO7 go high? I would suggest ensuring this works first, then try to change the GPIO name to 3.

    Regards,

    Vince Rodriguez
  • Hello,

    Yes the example worked. So I replaced the main example code by my main code above and it does also work.
    The problem is that I want to do this with a project I create and not a project I imported.
    The only difference between the controlSUITE imported example and the project I created, is the build configuration ( includes and linked files are the same).
    The example has a Flash build config that I don't have (only have Debug and Release). I did some reading about project build configurations but never was explained how to create a Flash config (I know how to create a new config but I don't know what makes this config a Flash).

    Do you think the problem is due to de Build config? What makes a build config Flash?

    Regards,

    Sébastien
  • Sebastien,

    I would suggest using a example project as your starting point, and not trying to create your own project from scratch.

    Regarding flash build config: You have two options when it comes to putting code into your device. You can run your code from RAM, which will put your code directly into RAM when you debug. the good things about this is that you aren't erasing any code that is saved in flash, but the bad news is that you are not putting your code into flash. This means that on power cycle, the code will be gone, and the system will boot from whatever code was stored into flash. If you run your code with FLASH, then the code will be saved to the FLASH of the device, then pulled to RAM to run. This allows you to power cycle the device and keep the code you wrote.

    The build configs are just ways of setting up the project that enable these different modes. There are two .cmd files that will either do flash or RAM, and one or the other will be excluded when your compile in a certain build. There could also be pre-defined variables that get commented in or out depending on your build config.

    For more info on programming the flash, you can view this page:

    processors.wiki.ti.com/.../FAQs