Other Parts Discussed in Thread: CONTROLSUITE
Hi all,
I bought the subject LaunchPad and proceeded to start the obligatory 'hello world' flashing LED project -which has been painful to say the least, but, after a few days I have figured out most of the ins & outs of CCS and the platform.
My problem right now is that my code - toggle LEDs on button press - works fine when I step through it (F5) but if I actually play it (F8 button) it seems to start running code from flash (if that's possible)????EDIT: After it runs though once or possible a few times, not sure what it's clocked at. I am not certain about this but it looks like the temp/adc example that came loaded on it (no serial comms though)- LEDs 3 and 4 remain on and if I try to do anything in the debugger - eg pause, it crashes and gives me this error: No source available for "0x3f63b6" .... The code should just sit in an infinite loop, but it is getting out somehow?
I'm also curious about the GPAPUD register - Pull up Disable Register - which I only set after manually playing in the registers and seeing that the push button latched without this set high? What does this actually do?
And how to use the "reset" tactile button as a GPIO switch? The schematic looks like I can put a jumper at J6-5 to J2-5 and use it as GPIO4. I would need to disable the reset on the mcu though (?)- and it also seems to lack a pull down resistor - so not sure if its even possible???
Finally, Can someone point me in the direction of a tutorial or something similar showing how to run a CCS project from flash? - cant seem to figure it out.
Thanks for help on any of the above.
code - meant to be as simple as possible - first time writing for ti gear/ full extent of my training is opening up the datasheet to the registers page- so any and all advice welcome.
/*
* main.c
*/
#include "DSP28x_Project.h"
//#include "PeripheralHeaderIncludes.h"
//#pragma CODE_SECTION(InitFlash, "ramfuncs");
//#define Device_cal (void (*)(void))0x3D7C80
unsigned int i =0;
void main(void) {
EALLOW;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0; //Set to GPIO
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0;
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0;
GpioCtrlRegs.GPAPUD.bit.GPIO12 =1; //Pull Up Disable Register
GpioCtrlRegs.GPADIR.bit.GPIO0 = 1;
GpioCtrlRegs.GPADIR.bit.GPIO1 = 1;
GpioCtrlRegs.GPADIR.bit.GPIO2 = 1; //Set GPIO 0-3 as Output
GpioCtrlRegs.GPADIR.bit.GPIO3 = 1;
GpioCtrlRegs.GPADIR.bit.GPIO12 = 0;
//GpioDataRegs.GPACLEAR.bit.GPIO0 = 1; // SET INPUT TO LOW.
//GpioDataRegs.GPACLEAR.bit.GPIO1 = 1;
//GpioDataRegs.GPACLEAR.bit.GPIO2 = 1;
//GpioDataRegs.GPACLEAR.bit.GPIO3 = 1;
EDIS;
GpioDataRegs.GPATOGGLE.bit.GPIO0 = 1;
GpioDataRegs.GPATOGGLE.bit.GPIO1 = 1;
GpioDataRegs.GPATOGGLE.bit.GPIO2 = 1;
GpioDataRegs.GPATOGGLE.bit.GPIO3 = 1;
while(1==1){
if(GpioDataRegs.GPADAT.bit.GPIO12 != 1)
{ GpioDataRegs.GPATOGGLE.bit.GPIO0 = 1;
GpioDataRegs.GPATOGGLE.bit.GPIO1 = 1;
GpioDataRegs.GPATOGGLE.bit.GPIO2 = 1;
GpioDataRegs.GPATOGGLE.bit.GPIO3 = 1;}
}
}

