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.

TMS320F28035: TMS320F28035

Part Number: TMS320F28035

For a new project I am trying to use TMS320F28035.  I tried to run the example program  Example_2803xAdcSoc.c in the Experimenter kit.  It is working fine when I run from RAM compiling with "28035_RAM_lnk.cmd".  However when I run from flash using "  F28035.cmd"  the program crash and debugger shows that it has landed in ILLEGAL_ISR(void) at DSP2803x_DefaultIsr.c.   Could you help me what could be the issue

Regards,

Ramesh

  • Ramesh,

    The issue is that the F28035.cmd file, while loading the code to flash,also has a directive for any section defined as "ramfuncs" to be loaded to flash, but copied/ran from RAM.  The copy from flash to RAM has to be taken care of in your C code before any function in this section is called.  The example you picked, ADCSoc is mapping the usDelay function to the section "ramfuncs", but since you have not copied it from flash to RAM, the code will branch to where it expects the function to be in memory, but it will not be there and eventually you will hit an illegal ISR executing from undefined memory.

    Here's the section in the .cmd file that is directing the linker to load the code to flash but execute it from RAM:

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

    To fix this you need to add these lines of code to the Example_2803x_AdcSoc.c file before main

    extern Uint16 RamfuncsLoadStart;
    extern Uint16 RamfuncsLoadEnd;
    extern Uint16 RamfuncsRunStart;
    extern Uint16 RamfuncsLoadSize;

    Then add this line before InitAdc() is called

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

    Recompile/re-load and things should work now.

    Best,

    Matthew

  • Hi Mathew,

    Thanks for the support.  I updated the code.  Now the it is not stuck in illegal isr but still not working.  The ADC data is not updated and LoopCount is not getting updated.  Debugger is in a frozen state.  

    Regards,

    Ramesh

  • Ramesh,

    Thanks for updating, there is another function that was meant to be ran from RAM, and when placed in flash the memory access time is too slow for this to work properly.

    If you open the DSP2803x_ADC.c file you will see the  below function at line 208

    Uint16

    AdcConversion(void)

    Put this statement above the function

    #pragma CODE_SECTION(AdcConversion,"ramfuncs");

    This will place the function in RAM as well, and things should work normally after that.

    Best,

    Matthew

  • Thanks Matthew.  It is working fine now.

    Regards,

    Ramesh