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.

Problem getting example program to execute from flash on TMS320F2808

Other Parts Discussed in Thread: TMS320F2808

I just recently picked up the TMS320F2808 Experimenters Kit, and I am running through the example programs for each of the peripherals that I will be using in my application.  I have executed the ADC example program (adc_soc) from ram, and I am attempting to modify it to execute from flash.  However, when I step through the program, I get an illegal operation trap inside the InitAdc() function.  When I step into the function, I discover that the error occurs when executing the DELAY_US(ADC_usDELAY) instruction.

Referencing the instructions in the DSP280x_HeaderFiles_QuickStart_Readme.pdf document, I have been successful in modifying the SCI example program to execute from flash.

Any suggestions would be greatly appreciated.

RaulO

  • Hi

    I encountered the same problem in the past  i just commented the delay line, because the first result you get from your ADC in simultaneous mode is allways incorrect and you have to discard this (refer errata page13). After that it works correctly so the delay is not necessary in my eyes.

    But im Interested in solving  this Error because i cant use the function DELAY_US().

  • Thanks for the response Stephan.  I tried your suggestion, and the program ran correctly.

  • The header files and peripheral examples put the delay function into the "ramfuncs" assembly section.  In the linker .cmd file you will probably find something like this:

       ramfuncs:    LOAD = FLASHD,
                             RUN = RAML0,
                             LOAD_START(_RamfuncsLoadStart),
                             LOAD_END(_RamfuncsLoadEnd),
                             RUN_START(_RamfuncsRunStart),
                             PAGE = 0

    This means the linker will assign the section such that it is loaded into flash (FLASHD), but run from ram (RAML0).    Any function you want to RAM should be setup in this way in a flash based project.  Usually it is run from RAM due to timing (needing zero wait) or because the function configures the flash itself.

    In order to put the function in RAM you need to copy it from flash to RAM.  The run from flash examples in the header files and peripheral examples show how to do this and the "Executing the Examples From Flash" section of the quick start documentation also gives some pointers.   If you do not copy functions with a RAM run address it to RAM then you will execute garbage which will most likely eventually put you into the ITRAP vector.

    -Lori

  • Ah i see i think i just forgot to use the MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);

    Function.

    Right now i have no time to check if the DELAY_US() works then, but i will check later.