TMS320F335 behaves differently in CCS or Standalone

Dear community,

I am developing a motor control application on the TMS320F28335. I have the application to work properly as standalone and within CCS.

I am now working on the configuration part (some parameters may have to be tuned) and I do that with MODBUS, everything works fine.

When I have my parameters ready once and for all I would like to save them in FLASH and eventually recover them upon next reset. To do that I take advantage of the FlashAPI library. I can store and recover the parameters while the board is attached to CCS but in standalone mode something in the data recovery from Flash goes wrong (I think I read all 0xFFFF but I cannot be too sure as I have nothing to really "debug"  the thing while the board is disconnected).

To make the system standalone in the first place I used the tutorial on "Copy compiler sections from Flash to RAM on the TMS320F28xxx DSCs" (spraau8). And I have the feeling that there could be something missing in that document for data that have to born live and die in Flash memory.

To save the parameters in Flash and restore them I use the following code:


ModbusRegsFlashFile    : > FLASHE,        PAGE = 0


Uint16 mbWriteRegsIntoFlash(void){
    FLASH_ST ProgStatus,EraseStatus;
    Uint16 Status;

    Status = Flash_Erase(SECTORE,&EraseStatus); //Please, check the sector in .cmd file
        puts("Flash erase sector B error");
        Status = Flash_Program((Uint16 *) &ModbusRegsFlash[0],(Uint16 *) &ModbusRegs[0],MB_REG_FLASH_SIZE,&ProgStatus);
            puts("Flash program error");

    return Status;


#pragma DATA_SECTION(ModbusRegsFlash,"ModbusRegsFlashFile");
int16 ModbusRegsFlash[MB_REG_FLASH_SIZE];


void copy_values_to_ram(void)
    int i;

    //Copy everything to RAM!

    for(i=0; i < MB_REG_FLASH_SIZE; i++)

        ModbusRegs[i] = ModbusRegsFlash[i];




Any help on this issue is really appreciated, many thanks for your precious time!