Flashing program to a DSP TI F28035

A. Why it is necessary?

Basically, flashing the program into the DSP is a very important step in digital signal processor. In term of Power Supply Converter, the digital controller has been more popular due to the ease of controller modification without changing the hardware. It also offer a smaller circuitry compare to the analog controller. As the consequence the size of the controller can be reduce. These advantages only some part of the digital control advantages.

When a designer has finished writing the program which will be applied to a circuit, testing the performance is the next step. Without flashing the program to our DSP memory, we need to attach our DSP kit to our computer by using a USB or a JTAG emulator. But when we have done a program, we can’t longer attach a computer to run a Power Supply Control, so that we need to transfer all the program to the DSP memory without losing it when the power supply is turned off.  So the controller will always work whenever it is run. This is why flashing the program to a DSP memory is necessary.

B. How to flash the program?

In order to flash the program into the memory we need to do some steps. Here, I consider we already done a program.

  1. Initialize the  RAMFlash function and Flash Function by add this code in the initialization step of the main program.

void InitRAMFlash(void);

void InitFlash(void);

  1. Add this line after initialization.

void MemCopy(Uint16 *SourceAddr, Uint16* SourceEndAddr, Uint16* DestAddr);

  1. Main function add this line

InitRAMFlash();

  1. Write the function of InitRAMFLash(void) as shown below

 

void InitRAMFlash(void)

{

       MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);

       InitFlash();

}

#pragma CODE_SECTION(InitFlash, “ramfuncs“);

  1. Make sure you already have the InitFlash function, sometimes it already include in DSP2803x_SysCtrl.c, in case it doesn’t include, we can add this line presented below

void InitFlash(void)

{

   EALLOW;

   //Enable Flash Pipeline mode to improve performance

   //of code executed from Flash.

   FlashRegs.FOPT.bit.ENPIPE = 1;

   //                CAUTION

   //Minimum waitstates required for the flash operating

   //at a given CPU rate must be characterized by TI.

   //Refer to the datasheet for the latest information.

   //Set the Paged Waitstate for the Flash

   FlashRegs.FBANKWAIT.bit.PAGEWAIT = 2;

   //Set the Random Waitstate for the Flash

   FlashRegs.FBANKWAIT.bit.RANDWAIT = 2;

   //Set the Waitstate for the OTP

   FlashRegs.FOTPWAIT.bit.OTPWAIT = 3;

   //                CAUTION

   //ONLY THE DEFAULT VALUE FOR THESE 2 REGISTERS SHOULD BE USED

   FlashRegs.FSTDBYWAIT.bit.STDBYWAIT = 0x01FF;

   FlashRegs.FACTIVEWAIT.bit.ACTIVEWAIT = 0x01FF;

   EDIS;

   //Force a pipeline flush to ensure that the write to

   //the last register configured occurs before returning.

   __asm(” RPT #7 || NOP”);

}

  1. Make sure to allocate memory for flashing program, check the linker F28035.cmd, and see whether the line below has been written

ramfuncs            : LOAD = FLASHA,

                         RUN = RAML0,

                         LOAD_START(_RamfuncsLoadStart),

                         LOAD_END(_RamfuncsLoadEnd)

                         LOAD_SIZE(_RamfuncsLoadSize),

                         RUN_START(_RamfuncsRunStart),

                         PAGE = 0

Note:

LOAD is the place where the .text section was programmed

Run is the RAM section where the code to be loaded

MemCopy fuction will then copy the code from FLASH to RAM as defined with these symbols.

  1. Debug to check!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s