Overview

In this tutorial, we will learn how to blink the LED using the TMS320F28335 microcontroller.

SOFTWARE: 

Code Composer Studio

HARDWARE REQUIRED:

  • DSP controller board (TMS320F28335)
  • JTAG, XDS100V2 board

Specifications:

TMS320F28335 Microcontrollers

On-chip memory

  • 256K × 16 Flash, 34K × 16 SARAM
  • Clock frequency: Up to 150 MHz (6.67-ns cycle time)
  • Operating voltage: 1.9-V/1.8-V core, 3.3-V I/O design
  • Six-channel DMA controller (for ADC, McBSP, ePWM, XINTF, and SARAM)

Communications peripherals

  • Up to 2 CAN modules
  • Up to 3 SCI (UART) modules
  • Up to 2 McBSP modules (configurable as SPI)
  • One SPI module
  • One Inter-Integrated Circuit (I2C) bus

Analog subsystem

  • 12-bit ADC, 16 channels
  • 80-ns conversion rate
  • 2 × 8 channel input multiplexer
  • Two sample-and-hold
  • Single/simultaneous conversions
  • Internal or external reference

Enhanced control peripherals (EPWM)

  • Up to 18 PWM outputs
  • Up to 6 HRPWM outputs with 150-ps MEP resolution

•16-bit or 32-bit External Interface (XINTF)

  • GPIO0 to GPIO63 pins can be connected to one of the eight external core interrupts
  • –Up to 18 PWM outputs
  • –Up to 6 HRPWM outputs with 150-ps MEP

Up to 88 individually programmable, multiplexed GPIO pins with input filtering

Three 32-bit CPU timers

THEORY:

LEDs (LEDs) are the most commonly used components, usually to display the digital status of contacts.

The TMS320F28335 board has 4 LEDs connected to general-purpose DSP I / O contacts. The anode of each LED is connected to the ground, and the cathode of each LED is connected to the port via a 220-ohm resistor. To turn on a single LED, set the signal of the corresponding port to high.

General Purpose I / O Peripheral (GPIO) in the TMS320 Digital Signal Processor (DSP). The GPIO peripheral provides special general-purpose contacts that can be configured as inputs or outputs. When configured as an input, we can determine the status of the input by reading the state of the internal register. When configured as an output, we can write to the internal register to monitor the managed state on the output contact.

GPIO Connection

S.NoGPIOControl Card
1GPIO_3GPIO3

RESULT:

Hence by the above code, we have blinked the LED with the 1 GPIO Pins.

Final Code For Single Led Blink

/*
 * main.c
 *
 *  Created on: 16-Mar-2022
 *      Author: Admin
 */

#include "DSP28x_Project.h"     // Device Headerfile and Examples Include FileS

void main(void)
{
    // Step 1. Initialize System Control:
    // PLL, WatchDog, enable Peripheral Clocks
    // This example function is found in the DSP2833x_SysCtrl.c file.
       InitSysCtrl();

EALLOW;
GpioCtrlRegs.GPAMUX1.bit.GPIO3=0;
GpioCtrlRegs.GPADIR.bit.GPIO3=1;
GpioCtrlRegs.GPAPUD.bit.GPIO3=0;
EDIS;

while(1)
{
    GpioDataRegs.GPATOGGLE.bit.GPIO3=1;
    DELAY_US(1000000);
}

}

Final Code For Multiple Led Blink

/*
 * main.c
 *
 *  Created on: 16-Mar-2022
 *      Author: Devilal
 */

#include "DSP28x_Project.h"   //Device headerfile

void main(void)

{
  InitSysCtrl();
   // gpio configuration
   EALLOW;

   GpioCtrlRegs.GPAMUX1.bit.GPIO1=0;  // selecting the gpio pin
   GpioCtrlRegs.GPADIR.bit.GPIO1=1;   //1 mean output pin,0 mean input pin
   GpioCtrlRegs.GPAPUD.bit.GPIO1=0;   // input selection completed

   GpioCtrlRegs.GPAMUX1.bit.GPIO2=0;// selecting the gpio pin
   GpioCtrlRegs.GPADIR.bit.GPIO2=1;//1 mean output pin,0 mean input pin
   GpioCtrlRegs.GPAPUD.bit.GPIO2=0;// input selection completed


  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;// input selection completed

  GpioCtrlRegs.GPAMUX1.bit.GPIO4=0;// selecting the gpio pin
  GpioCtrlRegs.GPADIR.bit.GPIO4=1;//1 mean output pin,0 mean input pin
  GpioCtrlRegs.GPAPUD.bit.GPIO4=0;// input selection completed

  GpioCtrlRegs.GPAMUX1.bit.GPIO5=0;// selecting the gpio pin
  GpioCtrlRegs.GPADIR.bit.GPIO5=1;//1 mean output pin,0 mean input pin
  GpioCtrlRegs.GPAPUD.bit.GPIO5=0;// input selection completed

  GpioCtrlRegs.GPAMUX1.bit.GPIO6=0;// selecting the gpio pin
  GpioCtrlRegs.GPADIR.bit.GPIO6=1;//1 mean output pin,0 mean input pin
  GpioCtrlRegs.GPAPUD.bit.GPIO6=0;// input selection completed

  GpioCtrlRegs.GPAMUX1.bit.GPIO7=0;// selecting the gpio pin
  GpioCtrlRegs.GPADIR.bit.GPIO7=1;//1 mean output pin,0 mean input pin
  GpioCtrlRegs.GPAPUD.bit.GPIO7=0;// input selection completed

  GpioCtrlRegs.GPAMUX1.bit.GPIO8=0;// selecting the gpio pin
  GpioCtrlRegs.GPADIR.bit.GPIO8=1;//1 mean output pin,0 mean input pin
  GpioCtrlRegs.GPAPUD.bit.GPIO8=0;// input selection completed

  GpioCtrlRegs.GPAMUX1.bit.GPIO9=0;// selecting the gpio pin
  GpioCtrlRegs.GPADIR.bit.GPIO9=1;//1 mean output pin,0 mean input pin
  GpioCtrlRegs.GPAPUD.bit.GPIO9=0;// input selection completed


EDIS;
  while(1)
  {
      GpioDataRegs.GPACLEAR.bit.GPIO1=1; // turns on the led;(1 means  turn on,0 means turns off)
      GpioDataRegs.GPACLEAR.bit.GPIO2=1;// turns on the led;(1 means  turn on,0 means turns off)
      GpioDataRegs.GPACLEAR.bit.GPIO3=1;// turns on the led;(1 means  turn on,0 means turns off)
      GpioDataRegs.GPACLEAR.bit.GPIO4=1;// turns on the led;(1 means  turn on,0 means turns off)
      GpioDataRegs.GPACLEAR.bit.GPIO5=1;// turns on the led;(1 means  turn on,0 means turns off)
      GpioDataRegs.GPACLEAR.bit.GPIO6=1;// turns on the led;(1 means  turn on,0 means turns off)
      GpioDataRegs.GPACLEAR.bit.GPIO7=1;// turns on the led;(1 means  turn on,0 means turns off)
      GpioDataRegs.GPACLEAR.bit.GPIO8=1;// turns on the led;(1 means  turn on,0 means turns off)
      GpioDataRegs.GPASET.bit.GPIO9=1;// turns on the led;(1 means  turn on,0 means turns off)
      DELAY_US(1000000); //turns off after a delay of 1000000 microseconds
      GpioDataRegs.GPASET.bit.GPIO1=1;  // turns off the led (1 means  turn off,0 means turns on)
      GpioDataRegs.GPASET.bit.GPIO2=1; // turns off the led (1 means  turn off,0 means turns on)
      GpioDataRegs.GPASET.bit.GPIO3=1; // turns off the led (1 means  turn off,0 means turns on)
      GpioDataRegs.GPASET.bit.GPIO4=1; // turns off the led (1 means  turn off,0 means turns on)
      GpioDataRegs.GPASET.bit.GPIO5=1; // turns off the led (1 means  turn off,0 means turns on)
      GpioDataRegs.GPASET.bit.GPIO6=1; // turns off the led (1 means  turn off,0 means turns on)
      GpioDataRegs.GPASET.bit.GPIO7=1; // turns off the led (1 means  turn off,0 means turns on)
      GpioDataRegs.GPASET.bit.GPIO8=1; // turns off the led (1 means  turn off,0 means turns on)
      GpioDataRegs.GPACLEAR.bit.GPIO9=1; // turns off the led (1 means  turn off,0 means turns on)
      DELAY_US(1000000); //turns on after a delay of 1000000 microseconds



  }
}

Output Images

By Devilal

Leave a Reply

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