MEVIHUB

Mastering the Art of Blinking with TMS320F280025C Microcontroller

Overview:

We explore the fundamental idea of flashing an LED with the TMS320F280025C microcontroller in this article. With the use of GPIO (General Purpose Input/Output) pins, beginners may control an LED by following the detailed instructions in this manual.

Required components

S.NoCOMPONENTSQty
1TMS320F280025C microcontroller1Buy F280025C From Mouser
2Connection hardware(JTAG,USB) 1Buy F280025C From Mouser
3LED1Buy Led From Amazon
4Current-limiting resistor1Buy 10-ohm Resistor From Amazon
5connection wires1Buy Jumper Wires From Amazon

Block Diagram

Specification of TMS320F280025C

SpecificationDescription
CPU Core32-bit C28x
Operating FrequencyUp to 100 MHz
Floating-Point Unit (FPU)Yes
Flash MemoryUp to 128 KB
RAMUp to 24 KB
Communication InterfacesUART, SPI, I2C, CAN, etc.
PWM ModulesEnhanced modules for motor control
Analog-to-Digital ConverterHigh-resolution ADC for precise analog signal measurement
Digital-to-Analog ConverterBuilt-in DAC for analog signal generation
DMADirect Memory Access for efficient data transfer
TimersHigh-resolution timers for accurate timing control
Operating Temperature Range-40°C to 105°C
Supply Voltage Range3.3V
Package OptionsLQFP, VQFN
Development EnvironmentCode Composer Studio (CCS) IDE

Development Environment

The development environment should be set up.

  1. Install Code Composer Studio: Go to the Texas Instruments website, get CCS, and then install it.
  2. Connect Hardware: Using an appropriate connection method (such as a USB cable or JTAG debugger), connect your TMS320F280025C microcontroller to your computer.
  3. Create a new project for your microcontroller in CCS by opening the program. CCS will create the required project files after you choose the proper device.

Introduction

In addition to the CPU-controlled I/O functionality, up to twelve separate peripheral signals can be multiplexed on a single GPIO-enabled pin. A peripheral device or one of the CPU masters can control each pin output.

There are up to 8 possible I/O ports:

Device GPIO Setup

Set Pin Direction

Since we want to control an LED connected to the pin, we will configure it as an output pin. We set the direction of GPIO3 in GPIO port A as an output.

    GpioCtrlRegs.GPADIR.bit.GPIO3=1;    // 1 mean output pin,0 mean input pin

Set Pin Pull-Up/Pull-Down:

For our LED blinking example, we won’t need to configure the pin’s internal pull-up or pull-down resistors. However, in other scenarios where you connect external buttons or switches, you may want to set the appropriate pull-up or pull-down configuration.

GpioCtrlRegs.GPAPUD.bit.GPIO3=0;    // 0 Enables the Pull-Up. 1 Disables the Pull-Up.

Configure Pin Output

For each pin configured as a GPIO, specify the direction of the pin as either input or output using the
GPyDIR registers. By default, all GPIO pins are inputs. Before changing a pin to output, load the output
latch with the value to be driven by writing that value to the GPySET, GPyCLEAR, or GPyDAT registers.
Once the latch is loaded, write to GPyDIR to change the pin direction. By default, all output latches are zero. The GPyDIR register can be used to read what value was written to the GPyDIR register.

EALLOW Register

The “EALLOW” directive is used to temporarily enable access to these protected registers, allowing the programmer to modify them as needed.

typically, the “EALLOW” directive is paired with the “EDIS” directive, which stands for “Disable Access to Protected Registers.” The “EDIS” directive is used to disable access to the protected registers once the required modifications have been made.

GPIO Registers

GPIO_CTRL_REGS Registers

Source Code

/*
 * Main.c
 *
 *  Created on: xx-xx-20xx
 *      Author: Admin
 */


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


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

    EALLOW;
    GpioCtrlRegs.GPAMUX1.bit.GPIO3=0;   // selecting the gpio pin
    GpioCtrlRegs.GPADIR.bit.GPIO3=1;    // 1 mean output pin,0 mean input pin
    GpioCtrlRegs.GPAPUD.bit.GPIO3=0;    // 0 Enables the Pull-Up. 1 Disables the Pull-Up.
    EDIS;


    while(1)
    {
        GpioDataRegs.GPATOGGLE.bit.GPIO3=1;
        GpioDataRegs.GPASET
        DEVICE_DELAY_US(500000);
    }


}

Exit mobile version