DSPRelated.com
Forums

Programming the FLASH - TMS320C2812

Started by BIT May 30, 2006
Hi all,

I am trying to erase the FLASH of TMS320F2812 using the custom API
provided by TI.

http://focus.ti.com/dsp/docs/dspplatformscontento.tsp?sectionId=2&familyId=510&tabId=517

In one of the steps it talks about initializing the PLL control
register from using software delays. The PLL lock time is 131072
cycles. Any idea how I can write C-code for such a delay.

Thanks,

Ram

Hi Ram

check in
C:\tidcs\c28\dsp281x\v100\DSP281x_common\source\DSP281x_SysCtrl.c
you should have it if you installed C/C++ Header files

Mitja

BIT wrote:
> Hi all, > > I am trying to erase the FLASH of TMS320F2812 using the custom API > provided by TI. > > http://focus.ti.com/dsp/docs/dspplatformscontento.tsp?sectionId=2&familyId=510&tabId=517 > > In one of the steps it talks about initializing the PLL control > register from using software delays. The PLL lock time is 131072 > cycles. Any idea how I can write C-code for such a delay. > > Thanks, > > Ram
Hi Mitja,

That was real cool. I found the code :

 for(iVol= 0; iVol< ( (131072/2)/12 ); iVol++)
      {

      }


but I don't quite understand how the above FOr loop would produce a
131072 cycles delay

What is that (131072/2)/12 refer to.

Thanks,

Ram





Korenje wrote:
> Hi Ram > > check in > C:\tidcs\c28\dsp281x\v100\DSP281x_common\source\DSP281x_SysCtrl.c > you should have it if you installed C/C++ Header files > > Mitja > > BIT wrote: > > Hi all, > > > > I am trying to erase the FLASH of TMS320F2812 using the custom API > > provided by TI. > > > > http://focus.ti.com/dsp/docs/dspplatformscontento.tsp?sectionId=2&familyId=510&tabId=517 > > > > In one of the steps it talks about initializing the PLL control > > register from using software delays. The PLL lock time is 131072 > > cycles. Any idea how I can write C-code for such a delay. > > > > Thanks, > > > > Ram
I'm assuming they looked at the corresponding assembly code and 
determined that it was taking 12 cycles per loop iteration once you 
consider the cycles consumed by the variable increment and the branch. 
I usually do those types of delays like this:

// be sure to use "volatile" so optimizer does not remove this loop
volatile int i;

for(i=0; i<CYCLE_COUNT; i++);	// delay loop

This will probably have more than one cycle per loop and end up being a 
multiple of CYCLE_COUNT but as long as it's nothing in a critical path 
then who cares.  The PLL lock time is a minimum so going over the amount 
of time poses no problem and since it only happens once you won't notice 
in your system.

I don't know what optimization settings that code you saw with the /12 
in it was written for so I'd be inclined to get rid of it or else turn 
off optimization for that particular file.

Brad

BIT wrote:
> Hi Mitja, > > That was real cool. I found the code : > > for(iVol= 0; iVol< ( (131072/2)/12 ); iVol++) > { > > } > > > but I don't quite understand how the above FOr loop would produce a > 131072 cycles delay > > What is that (131072/2)/12 refer to. > > Thanks, > > Ram > > > > > > Korenje wrote: >> Hi Ram >> >> check in >> C:\tidcs\c28\dsp281x\v100\DSP281x_common\source\DSP281x_SysCtrl.c >> you should have it if you installed C/C++ Header files >> >> Mitja >> >> BIT wrote: >>> Hi all, >>> >>> I am trying to erase the FLASH of TMS320F2812 using the custom API >>> provided by TI. >>> >>> http://focus.ti.com/dsp/docs/dspplatformscontento.tsp?sectionId=2&familyId=510&tabId=517 >>> >>> In one of the steps it talks about initializing the PLL control >>> register from using software delays. The PLL lock time is 131072 >>> cycles. Any idea how I can write C-code for such a delay. >>> >>> Thanks, >>> >>> Ram >