SLUAAP5 july   2023 UCD3138 , UCD3138064 , UCD3138064A , UCD3138128 , UCD3138128A , UCD3138A , UCD3138A64

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Why Lockup Can Occur
  5. 2Reasons for Lockup
    1. 2.1 Wrong Code in the load.asm
    2. 2.2 Misoperation with TI GUI
    3. 2.3 zero_out_integrity_word Function Fails
    4. 2.4 PMBus Communication Fails
    5. 2.5 Unexpected Occurrences
  6. 3How to Avoid a Lockup
  7. 4Unlock with JTAG
    1. 4.1 Enable JTAG Functionality
    2. 4.2 New Target Configuration in CCS
    3. 4.3 Clear the Flash
  8. 5Summary
  9. 6References

zero_out_integrity_word Function Fails

zero_out_integrity_word function is used to clear the specified location of checksum. A lockup can occur when the zero_out_integrity_word function does not compile in 32-bit mode. This function is normally in an independent file named zero_out_integrity_word.c. The function name or file name can be slightly different from project to project, but generally looks like the following.

#define program_flash_integrity_word (*((volatile unsigned long *) 0x7ffc))
//last word in flash, when executing from Flash.  used to store integrity code

void zero_out_integrity_word(void)
{
    DecRegs.FLASHILOCK.all = 0x42DC157E;// Write key to Program Flash Interlock Register
    DecRegs.MFBALR1.all = MFBALRX_BYTE0_BLOCK_SIZE_32K; //enable program flash write    program_flash_integrity_word = 0;
   DecRegs.MFBALR1.all = MFBALRX_BYTE0_BLOCK_SIZE_32K + MFBALRX_BYTE0_RONLY;

    while(DecRegs.PFLASHCTRL.bit.BUSY != 0)
    {
        ; //do nothing while it programs
}

    return;
}

To check whether this function/file is compiled in 32-bit mode:

  • Right click on zero_out_integrity_word.c > Properties > CCS Build > ARM Compiler > Processor Option > Designate code state.
  • If currently 16, change to 32 (as shown in Figure 2-2.)
  • Rebuild the project.

Note that this option is done with the configuration in CCS, so the zero_out_integrity_word function can possibly fail when the CCS version or compiler version is changed.


GUID-20230608-SS0I-PWGS-LCGW-NWCPTBMJSP6T-low.png

Figure 2-2 Designating Code State

Another option is to use a preprocessor directive #pragma telling the compiler to compile the specified function in 32-bit mode. The following is an example.

#define program_flash_integrity_word (*((volatile unsigned long *) 0x7ffc))
//last word in flash, when executing from Flash.  used to store integrity code

#pragma CODE_STATE(zero_out_integrity_word, 32) // 16 = thumb mode, 32 = ARM mode
void zero_out_integrity_word(void)
{
    DecRegs.FLASHILOCK.all = 0x42DC157E;// Write key to Program Flash Interlock Register
    DecRegs.MFBALR1.all = MFBALRX_BYTE0_BLOCK_SIZE_32K; //enable program flash write
    program_flash_integrity_word = 0;
   DecRegs.MFBALR1.all = MFBALRX_BYTE0_BLOCK_SIZE_32K + MFBALRX_BYTE0_RONLY; 
    while(DecRegs.PFLASHCTRL.bit.BUSY != 0)
    {
        ; //do nothing while it programs
}

    return;
}