This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/LAUNCHXL-F28069M: Blink LED Program not working

Part Number: LAUNCHXL-F28069M

Tool/software: Code Composer Studio

What changes should I make to run the program to blink an LED  in LAUNCHXL-F28069M?

This is my main program:

#include "F2806x_Device.h"      // F2806x Headerfile Include File
#include "F2806x_Examples.h"    // F2806x Examples Include File
int i;

void main()
{
    // Configure GPIO34 as a GPIO output pin
       EALLOW;
       GpioCtrlRegs.GPAMUX2.bit.GPIO22 = 0;
       GpioCtrlRegs.GPADIR.bit.GPIO22 = 1;
       EDIS;

       for(i = 0; i < 50; i++)
       {
           GpioDataRegs.GPATOGGLE.bit.GPIO22 = 1;
           DELAY_US(50000);
       }
}

I have connected an external LED to the GPIO pin 22.

The program does not have any compiler errors and can be loaded without any errors. But the LED is not blinking.

  • You didn't configure the system clock so DELAY_US probably is probably longer than you expect. Can you add the calls to initialize the device like we do in our examples (InitSysCtrl, InitPieCtrl, InitPieVectTable)?

    Are you able to single step through the code okay? When you you step over the write to GPATOGGLE, can you see the value in GPADAT change? When you step over DELAY_US() does run or do you get an illegal instruction trap?

    Thanks,

    Whitney

  • Thank you.

    I added the following codes:

    InitSysCtrl();

    InitPieCtrl();

    InitPieVectTable();

    Still the LED is not blinking.

    Yes, I am able to single step through the code till GPATOGGLE. When I step over the write to GPATOGGLE, no change in the value of GPADAT. When step over DELAY_US() , an error message appears.

    The screenshot of the error message is attached below.

  • Okay, that typically means that the underlying function in the DELAY_US() macro has not been copied from flash to RAM before being called. It's in ramfuncs, so you'll need to add a line in your device initialization that does this:

        memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (Uint32)&RamfuncsLoadSize);

    The flash_f28069 example demonstrates this if you need more details.

    Whitney