Other Parts Discussed in Thread: TMS320F2808
Hello I am a new user to this forum and to the TMS320F2808
I want to create a simple program where I can create a pulse at the digital output GPIO14/Pin 8
These are the files that I included in my project.
IDSP280x_CodeStartBranch.asm
DSP280x_CpuTimers.c
DSP280x_DefaultIsr.c
DSP280x_Device.h
DSP280x_Examples.h
DSP280x_GlobalVariableDefs.c
DSP280x_Gpio.c
DSP280x_Headers_nonBIOS.cmd
DSP280x_MemCopy.c
DSP280x_PieCtrl.c
DSP280x_PieVect.c
DSP280x_SysCtrl.c
DSP280x_usDelay.asm
F2808.cmd
main.c
TMS320F2808.ccxml
and here is the main program:
/*
* main.c
*/
#include "DSP280x_Device.h"
#include "DSP280x_Examples.h"
#include <stdio.h>
extern Uint16 RamfuncsLoadStart;
extern Uint16 RamfuncsLoadEnd;
extern Uint16 RamfuncsRunStart;
#pragma CODE_SECTION (InitFlash, "ramfuncs");
#pragma CODE_SECTION (delay, "ramfuncs");
#pragma CODE_SECTION (Gpio_setup, "ramfuncs");
#pragma CODE_SECTION (Toggle_G14, "ramfuncs");
void delay (void);
void Gpio_setup (void);
void Toggle_G14 (void);
unsigned int i;
void main(void)
{
InitSysCtrl ();
InitGpio ();
DINT;
InitPieCtrl ();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable ();
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
InitFlash ();
//section in here
Gpio_setup ();
while (1)
{
//Toggle_G14 ();
GpioDataRegs.GPADAT.bit.GPIO14 = 1;
delay ();
//Toggle_G14 ();
GpioDataRegs.GPADAT.bit.GPIO14 = 0;
delay ();
}
}
void delay (void)
{
i = 0;
for (i = 0; i<50000; i++);
}
void Gpio_setup (void)
{
//pull up gpapud
//dir output
//gpio mux1
EALLOW;
GpioCtrlRegs.GPAPUD.bit.GPIO14 = 0;//enable pullup
GpioCtrlRegs.GPAMUX1.bit.GPIO14 = 0;//GPIO
GpioCtrlRegs.GPADIR.bit.GPIO14 = 1; //output
GpioDataRegs.GPASET.bit.GPIO14 = 1;
EDIS;
}
void Toggle_G14 (void)
{
EALLOW;
//GpioDataRegs.GPATOGGLE.bit.GPIO14 = 1;
//GpioDataRegs.GPATOGGLE.all = 0xFFFFFFFF;
EDIS;
}
I also included the DSP280x_Headers/include and DSP280x_Common/include
I build it and then debugged it but still no results, the light on the DSP tms320f2808 Control Card is green.
but when I did these modification to my code:
void Gpio_setup (void)
{
//pull up gpapud
//dir output
//gpio mux1
/*EALLOW;
GpioCtrlRegs.GPAPUD.bit.GPIO14 = 0;//enable pullup
GpioCtrlRegs.GPAMUX1.bit.GPIO14 = 0;//GPIO
GpioCtrlRegs.GPADIR.bit.GPIO14 = 1; //output
GpioDataRegs.GPASET.bit.GPIO14 = 1;
EDIS;*/
EALLOW;
GpioCtrlRegs.GPAMUX1.all = 0x00000000;
GpioCtrlRegs.GPADIR.all = 0xFFFFFFFF;
EDIS;
}
and this in the main function:
while (1)
{
//Toggle_G14 ();
//GpioDataRegs.GPADAT.bit.GPIO14 = 1;
GpioDataRegs.GPADAT.all = 0xFFFFFFFF;
delay ();
//Toggle_G14 ();
//GpioDataRegs.GPADAT.bit.GPIO14 = 0;
GpioDataRegs.GPADAT.all = 0x00000000;
delay ();
}
and then Build it and Debug it, the code works, I got a green light and a red light flashing in the tms320f2808, and I got a pulse in most of the device's GPIOs.
Can someone please tell me why is this happening, and how can I generate a pulse on one pin only.
Notes:
I am new to this forum, tms320f2808,CCS v5 and C2000 microcontrollers, if I am in the wrong section, or you have any questions, please tell me.
Regards,
Forat

