Introduction

Because of the sheer complexity of the F2837xD devices, it is not uncommon for new users to have trouble bringing up the device the first time. This guide aims to give you, the user, a step by step guide for how to create and debug projects from scratch. This guide will focus on the user of an F2837xD control card, but these same ideas should apply to other boards with minimal translation.

Project Creation

Step_1 Create a new ccs project

create your project path location and enter your project name

Step_2 verify your device is connected to which port

Go to the device manager and check port

Step_3 Verify your device is connected or Not

Step_4 Include the required driver to project

In my system project location located below path

C:\ti\C2000Ware_3_04_00_00_Software\device_support\f2837xd\common

C:\ti\C2000Ware_3_04_00_00_Software\device_support\f2837xd\headers

Step_5 Create driver folder to save drivers

This image has an empty alt attribute; its file name is image-20.png

Step_6 Copy and past fallowing library files into the created Drivers folder

device.c

device.h

driverlib.h

F2837xD_CodeStartBranch.asm

You can Find those files in following path location

  • C:\ti\C2000Ware_3_04_00_00_Software\device_support\f2837xd\common\source
  • C:\ti\C2000Ware_3_04_00_00_Software\device_support\f2837xd\common\include

Step_7 Add driver lib.lib file to the project

Path location

C:\ti\C2000Ware_3_04_00_00_Software\driverlib\f2837xd\driverlib\ccs\debug

Step_8 Include all these added files to the project

Step_9 Add predefined symbols to the project

Step_10 Create main.c file and execute your code

/*
 * main.c
 *
 *  Created on: 25-Nov-2021
 *      Author: Devilal
 */
#include "stdio.h"
#include "string.h"
#include "stdlib.h"

#include "F28x_Project.h"
#include "F2837xD_device.h"
#include "F2837xD_Examples.h"

#include "device.h"
#include "driverlib.h"

void gpio_init();

void main(void)
{
    Device_init();
    Device_initGPIO();
    gpio_init();
    
    while(1)
{
        GPIO_writePin(DEVICE_GPIO_PIN_LED1, 1); // led1 mean GPIO 31
        GPIO_writePin(DEVICE_GPIO_PIN_LED2, 1); // led1 mean GPIO 34
        DEVICE_DELAY_US(1000000);

        GPIO_writePin(DEVICE_GPIO_PIN_LED1, 0);
        GPIO_writePin(DEVICE_GPIO_PIN_LED2, 0);
        DEVICE_DELAY_US(1000000);
}

}

void gpio_init()
{
    // config led 1
    GPIO_setPinConfig(DEVICE_GPIO_PIN_LED1);
    GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
    GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_STD);
    GPIO_setMasterCore(DEVICE_GPIO_PIN_LED1, GPIO_CORE_CPU1);

    // config led 2

    GPIO_setPinConfig(DEVICE_GPIO_PIN_LED2);
    GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED2, GPIO_DIR_MODE_OUT);
    GPIO_setPadConfig(DEVICE_GPIO_PIN_LED2, GPIO_PIN_TYPE_STD);
   GPIO_setMasterCore(DEVICE_GPIO_PIN_LED2, GPIO_CORE_CPU1);
}

How to access gpio register in your project

Step_1 Include F2827xD_Headers_nonBIOS_cpu1

Path location

Step_2 Copy and past f2827XD_GlobalVariableDefs.c

This .c file contains all gpio registrars

Final Code Using Registers_Method_1

/*
 * main.c
 *
 *  Created on: 25-Nov-2021
 *      Author: Devilal
 */
#include "stdio.h"
#include "string.h"
#include "stdlib.h"

#include "F28x_Project.h"
#include "F2837xD_device.h"
#include "F2837xD_Examples.h"

#include "device.h"
#include "driverlib.h"

void gpio_init();
void main(void)
{
    Device_init();
    Device_initGPIO();
    gpio_init();

    while(1)
    {
        GpioDataRegs.GPACLEAR.bit.GPIO31=1;
        DEVICE_DELAY_US(1000000);
        GpioDataRegs.GPASET.bit.GPIO31=1;
        DEVICE_DELAY_US(1000000);;
    }
}

void gpio_init()
{
    // config led 1
    GPIO_setPinConfig(DEVICE_GPIO_PIN_LED1);
    GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
    GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_STD);
    GPIO_setMasterCore(DEVICE_GPIO_PIN_LED1, GPIO_CORE_CPU1);

    // config led 2

    GPIO_setPinConfig(DEVICE_GPIO_PIN_LED2);
    GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED2, GPIO_DIR_MODE_OUT);
    GPIO_setPadConfig(DEVICE_GPIO_PIN_LED2, GPIO_PIN_TYPE_STD);
   GPIO_setMasterCore(DEVICE_GPIO_PIN_LED2, GPIO_CORE_CPU1);
}

Final Code Using Registers Method_2

/*
 * main.c
 *
 *  Created on: 25-Nov-2021
 *      Author: Devilal
 */
#include "stdio.h"
#include "string.h"
#include "stdlib.h"

#include "F28x_Project.h"
#include "F2837xD_device.h"
#include "F2837xD_Examples.h"

#include "device.h"
#include "driverlib.h"

void gpio_init();

void main(void)
{
    Device_init();
    Device_initGPIO();
    gpio_init();

    while(1)
{
        
        GpioDataRegs.GPBSET.bit.GPIO52 = 1;
        DEVICE_DELAY_US(100000);
        GpioDataRegs.GPBCLEAR.bit.GPIO52 = 1;
        DEVICE_DELAY_US(100000);
}

}

void gpio_init()
{
    EALLOW;
    GpioCtrlRegs.GPBMUX2.bit.GPIO52 = 0;		// 0=GPIO,  1=EPWM1A,  2=Resv,  3=Resv
    GpioCtrlRegs.GPBDIR.bit.GPIO52=1;  // 1=OUTput,  0=INput
    GpioCtrlRegs.GPBCSEL3.bit.GPIO52=0; //xx00: CPU1 selected
                                        // xx01: CPU1.CLA1 selected
                                        // xx10: CPU2 selected
                                        // xx11: CPU2.CLA1 selected

    GpioCtrlRegs.GPBMUX2.bit.GPIO53 = 0;		// 0=GPIO,  1=EPWM1A,  2=Resv,  3=Resv
    GpioCtrlRegs.GPBDIR.bit.GPIO53=1;  // 1=OUTput,  0=INput
    GpioCtrlRegs.GPBCSEL3.bit.GPIO53=0; //xx00: CPU1 selected
                                        // xx01: CPU1.CLA1 selected
                                        // xx10: CPU2 selected
                                        // xx11: CPU2.CLA1 selected
    EDIS;
}

By Admin

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: