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.

TMS320F280049: program delete after plug out the card

Part Number: TMS320F280049


Hello,

i am trying to create sine wave using TMDXDOCK280049M,

my code is working after that i flash it, but if i plug out the bored the program are deleting it self.

the board is never use before.

  • I tried to play with the boot switch (S1) and check all of the state of it. GPIO24 and GPIO32 are stays low.
  • I tried to call InitGpio() function,but it still dont work,GPIO24 and GPIO32 are staying low.

here is my code:

#include "F28x_Project.h"
//
// Globals
//
volatile struct DAC_REGS* DAC_PTR[3] = {0x0,&DacaRegs,&DacbRegs};
//uint16_t dacval = 2048;

//
// Defines
//
#define REFERENCE_VDAC      0
#define REFERENCE_VREF      1
#define DACA         1
#define DACB         2

#define REFERENCE            REFERENCE_VDAC
#define DAC_NUM                DACA

//
// Function Prototypes
//
void configureDAC(uint16_t dac_num);



#define PERIOD 120
 static const uint16_t D_Val[PERIOD] = {  0x7ff, 0x86a, 0x8d5, 0x93f, 0x9a9, 0xa11, 0xa78, 0xadd, 0xb40, 0xba1,
                                          0xbff, 0xc5a, 0xcb2, 0xd08, 0xd59, 0xda7, 0xdf1, 0xe36, 0xe77, 0xeb4,
                                          0xeec, 0xf1f, 0xf4d, 0xf77, 0xf9a, 0xfb9, 0xfd2, 0xfe5, 0xff3, 0xffc,
                                          0xfff, 0xffc, 0xff3, 0xfe5, 0xfd2, 0xfb9, 0xf9a, 0xf77, 0xf4d, 0xf1f,
                                          0xeec, 0xeb4, 0xe77, 0xe36, 0xdf1, 0xda7, 0xd59, 0xd08, 0xcb2, 0xc5a,
                                          0xbff, 0xba1, 0xb40, 0xadd, 0xa78, 0xa11, 0x9a9, 0x93f, 0x8d5, 0x86a,
                                          0x7ff, 0x794, 0x729, 0x6bf, 0x655, 0x5ed, 0x586, 0x521, 0x4be, 0x45d,
                                          0x3ff, 0x3a4, 0x34c, 0x2f6, 0x2a5, 0x257, 0x20d, 0x1c8, 0x187, 0x14a,
                                          0x112, 0xdf, 0xb1, 0x87, 0x64, 0x45, 0x2c, 0x19, 0xb, 0x2,
                                          0x0, 0x2, 0xb, 0x19, 0x2c, 0x45, 0x64, 0x87, 0xb1, 0xdf,
                                          0x112, 0x14a, 0x187, 0x1c8, 0x20d, 0x257, 0x2a5, 0x2f6, 0x34c, 0x3a4,
                                          0x3ff, 0x45d, 0x4be, 0x521, 0x586, 0x5ed, 0x655, 0x6bf, 0x729, 0x794
                                        };
//
// Main
//
void main(void)
{
    InitGpio(); // new adding

    //
    // Initialize System Control:
    // PLL, WatchDog, enable Peripheral Clocks
    //
    InitSysCtrl();

    //
    // Disable CPU interrupts
    //
    DINT;

    //
    // Initialize the PIE control registers to their default state.
    // The default state is all PIE interrupts disabled and flags are cleared.
    //
    InitPieCtrl();

    //
    // Clear all interrupts and initialize PIE vector table:
    //
    IER = 0x0000;
    IFR = 0x0000;
    InitPieVectTable();

    //
    // Configure DAC
    //
    configureDAC(DAC_NUM);


    int i=0;


    while(1)
    {

            while(i<PERIOD)
            {
                 DAC_PTR[DAC_NUM]->DACVALS.all = D_Val[i];
                 DELAY_US(166.35);              //control on the frequency 166.35 = 50.0062hz
                i++;
            }
            i=0;
    }
}


//
// configureDAC - Configure specified DAC output
//
void configureDAC(uint16_t dac_num)
{
    EALLOW;
    DAC_PTR[dac_num]->DACCTL.bit.DACREFSEL = REFERENCE;
    DAC_PTR[dac_num]->DACOUTEN.bit.DACOUTEN = 1;
    DAC_PTR[dac_num]->DACVALS.all = 0;
    DELAY_US(10); // Delay for buffered DAC to power up
    EDIS;
}

//
// End of File

thank you very much

Michael

  • Michael,

    you code does not impact the state of the pins on startup. When the boot loader is reading the pins your code has not even started to execute. You code may reconfigure these pins for use after the boot mode selection has been read, but this is not an issue if you cannot correctly execute your code from flash.

    Where and how are you reading the state of the pin during start up? Also please note that for flash boot mode position 1 and position 2 of S1 need to be in the "off" position, this means that both switches should be "up" or away from the "ON" text written on top of the switch. 

    Have you tried following the example materials in the workshop? Section 10 should walk you through porting code to flash. It was written for a LaunchPad, but the software preparation should all be identical.

    https://training.ti.com/c2000-f28004x-microcontroller-workshop?context=1137791-1137780

    Regards,
    Cody