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.

CCS/UCD3138: dflash area was rewritten to 0xffffffff all over.

Part Number: UCD3138

Tool/software: Code Composer Studio

Suddenly, the following dflash area was rewritten to 0xffffffff all over.

00018880 _pmbus_dcdc_cal_constants            

0001888c _pmbus_dcdc_cal_nonpaged_constants    

00018890 _pmbus_dcdc_config_constants          

000188d0 _pmbus_dcdc_config_nonpaged_constants

00018900 _pmbus_checksum                      

 

I am sure parameters are not rewritten in Fusion digital power studio.

 

I doubt start_erase_task() in flash.c erase dflash area, because it is the only code, I can find, to erase the entire dflash area.

 

start_erase_task() is called the following if clause.

if ((checksum! = pmbus_checksum) && (pmbus_checksum! = 0x87654321))

I think (checksum! = pmbus_checksum) is always true and (pmbus_checksum! = 0x87654321) is usually false. So I think (pmbus_checksum! = 0x87654321) becomes ture.

 

Is it possible pmbus_checksum is broken by noise or misread pmbus_checksum?

  • You can find answers here:

    Here's the code to change to add a RAM flash key to provide protection if you can't correct the noise:

    Add to pmbus.c - may be somewhere else, depending on which code you are using:


    +int32 pmbus_write_dflash_key(void)
    +{
    + dflash_key = (pmbus_buffer[2] << 24) + (pmbus_buffer[3] << 16) + (pmbus_buffer[4] << 8) + pmbus_buffer[5];
    +
    + return PMBUS_SUCCESS;
    +}

    in switch statement in pmbus.c for write messages:

             case PMBUS_CMD_MFR_PARM_INFO:

                    return pmbus_write_parm_info();

                                   case PMBUS_CMD_MFR_PARM_VALUE:

                                                  return pmbus_write_parm_value();      

    +                             case PMBUS_CMD_MFR_SPECIFIC_35:

    +                                             return pmbus_write_dflash_key();

    in the software interrupt function, probably in interrupts.c, replace all writes of constants to FLASHILOCK with writes of the RAM variable

                                                    {

                                                                   return;                  // Invalid segment number

                                                   }

    -                                              DecRegs.FLASHILOCK.all = DATA_FLASH_INTERLOCK_KEY; //unlock flash write;

    +                                             DecRegs.FLASHILOCK.all = dflash_key; //unlock flash write;

                                                    // Set the bits in the Data Flash Control Register to erase the indicated segment

                                                   dflashctrl_shadow.all = DecRegs.DFLASHCTRL.all;             // Read the hardware register

                                                   dflashctrl_shadow.bit.PAGE_ERASE = 1;                                                // Erase one segment

                                                  //this clears read only bit to permit writes to data flash.

    -                                              DecRegs.FLASHILOCK.all = 0x42DC157E; //unlock flash write

    +                                             DecRegs.FLASHILOCK.all = dflash_key; //unlock flash write

    //                                           DecRegs.MFBALR2.bit.BLOCK_SIZE =2;

    //                                           DecRegs.MFBALR2.bit.ADDRESS = 0x22;

    @@ -181,7 +181,7 @@ void software_interrupt(Uint32 arg1, Uint32 arg2, Uint32 arg3, Uint8 swi_number)

                                                   while (byte_counter > 0)

                                                   {

                                                                   Uint32   temp_word = *src_ptr++;

    -                                                              DecRegs.FLASHILOCK.all = 0x42DC157E; //unlock flash write

    +                                                             DecRegs.FLASHILOCK.all = dflash_key; //unlock flash write

                                                                   // Write the temp word to DFlash.

                                                                   *dest_ptr = temp_word;

    in variables.h

    +EXTERN int32 dflash_key;

    You will need to do a block write of the key -  0x42DC157E if you want to do a store default all, or do other writes to data flash.  

    Best practice, which our customers generally follow, is to fix the board layout and power supply noise so the issue doesn't happen, and also put in a code fix as well.