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.

Write USER0 and USER1 TM4C129

Other Parts Discussed in Thread: LMFLASHPROGRAMMER

Hi,

I´m using a launchpad board and my application needs to change MAC address sending a command from uart. But when I use function FlashUserSet(user0, user1) (example: user0=0x00010203 and user1=0x00040506) and after I use FlashUserGet(&valuser0, &valuser1), I catch values valuser0 and valuser1 zero or random value.

Is There something that needs to be done to modify this registers?

 

Thanks,

Vinicius

  • Hello Vinicius,

    The usage is correct. Can you check via the debugger that the FLASH_USER0 and FLASH_USER1 registers actually contain the value?

    Regards

    Amit

  • Hi Amit,

    FLASH_USER0 and FLASH_USER1 receive incorrect values.

    uint32_t ulUser0, ulUser1;
    
        ulUser1 = 0x00223543; 
        ulUser0 = 0x000004A3;
    
    	if (!FlashUserSet(ulUser0, ulUser1) )  // here FLASH_USER0 become 0 and FLASH_USER1 0x400
    		System_printf("Flash OK %x  %x\n",ulUser0, ulUser1);
    	else
    		System_printf("Flash error %x  %x\n",ulUser0, ulUser1);	
    	
    	FlashUserGet(&ulUser0, &ulUser1);

  • Hello Vinivius,

    First thing you need to ensure is that the register is erased, as it may have the original MAC address. To do so run the Unlock Feature using LMFlashProgrammer.

    Secondly if the register is already programmed to a non 0xFFFFFFFF value, then a new value being programmed to this register would not yield the same value. Only the bits that are 1 which may become 0 will be turned. Consider this as an AND of the existing register value with the new value you are programming to it.

    Regards

    Amit

  • Hi Amit,

    Thank you so much, your tip worked! 

    I have another question: once the bit becomes 0, is it impossible to return to 1? Do I have to erase using LMFlashProgrammer?

    Vini

  • Hello Vinicius,

    There are a few registers in Flash Memory that can be committed and thus made non-volatile. These include the BOOTCFG, FMPRE, FMPPE and USER_REG's. If they have been committed then you would need to run the unlock sequence to restore the content back to factory default.

    If not then a simple erase of the application code followed by a power cycle will restore them.

    Regards

    Amit