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.

TMS320F280025C: Overwrite data at a flash address to 0x0000

Part Number: TMS320F280025C


Hi,

I have implemented a DFU over CAN, where the bootloader checks, if the application header is correct (a key) or not. To start a DFU, the application should modify the header to 0x0000, such that

the bootloader notice, that the firmware needs to be updated. I implemented a small program to test, if I can overwrite some flash data by using the Fapi_issueProgrammingCommand(), but the overwrite process always fails with a 0x48 error:

    /////////////////////////////////////////////////////////////////////////////////////////////////////Reset Flash header
    //Init flash first:
    initFlashSectors();
    EALLOW;

    uint16_t miniBuffer1[4] = {0x0000};
    uint16_t miniBuffer2[4] = {0x0000};

    miniBuffer1[0] = 0x46ab;
    miniBuffer1[1] = 0x17c4;
    miniBuffer1[2] = 0x1289;
    miniBuffer1[3] = 0x3ffe;
    //////////////////////////////////////////////////////////////////////////////////////////////////////Write first to flash header

    Fapi_issueProgrammingCommand((uint32_t *) 0x0008F000, miniBuffer1,
                    sizeof(miniBuffer1), 0, 0, Fapi_AutoEccGeneration);

    while (Fapi_checkFsmForReady() != Fapi_Status_FsmReady){};

    Fapi_FlashStatusType oFlashStatus = Fapi_getFsmStatus();

    //////////////////////////////////////////////////////////////////////////////////////////////////////Write to zero now


    Fapi_issueProgrammingCommand((uint32_t *) 0x0008F000, miniBuffer2,
                    sizeof(miniBuffer2), 0, 0, Fapi_AutoEccGeneration);

    while (Fapi_checkFsmForReady() != Fapi_Status_FsmReady){};

    oFlashStatus = Fapi_getFsmStatus();
    EDIS;

    /////////////////////////////////////////////////////////////////////////////////////////////////////Reset Flash header

    if(oFlashStatus) //Error occured
    {
        while(1)
        {
            //
            // Delay
            //
            GPIO_togglePin(34);
            DEVICE_DELAY_US(1e5);
    //        GPIO_togglePin(31);
        }
    }
    else
    {
        while(1) //No error occured
        {
            //
            // Delay
            //
            GPIO_togglePin(31);
            DEVICE_DELAY_US(1e6);
    //        GPIO_togglePin(31);
        }
    }

How can the data at a specific flash area be modified (of course with 0x0000, otherwise it will not work), without erasing the sector?