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.

MSP432E401Y: J-Link to Set MAC Address

Part Number: MSP432E401Y

Hi, 

I am using a Segger Compact and would like to use this to set the MAC Address on a MSP432E401Y.

I can read the MAC Address back from JLink.exe (MEM 0x400EC040, 8). 

How can I set the MAC address after the bootloader is programmed?

Thanks,

 

  • Hi Catherine,

    From looking at this thread here, you should be able to update the MAC Address by programming the USERREGs. It looks like you can do this with the FlashUserSet call in the SDK. Please, try this and let me know if this works for you.

    Thanks,

    -Eric Rentschler

  • Hi, 

    Thanks, that explanation makes sense.

    However, it’s not quite what I’m trying to achieve, I am looking for a way to set the MAC address after I've programmed the bootloader in J-Link. Is there a way to do that?

    Is there a particular address for the USERREGs that I can write to via J-Link.exe.

  • Hi Catherine,

    Looks like the USEREGs start at 0x400FE1E0. 

    Thanks,

    -Eric Rentschler

  • You can write to USER_REG0/1 at 0x400FE1E0/4, but the values won't persist (over a Reset) until they have been "Commit"ted.

    The Commit procedure is described in TRM (SLAU723A) Sec 7.2.3.12 and illustrated in the Driverlib function FlashUserSave(). I imagine this could be done in a JLink script, though I haven't had occasion to script a busy-wait (loop).

    I don't see a .gel procedure to do this. The debugger (Tools->On-Chip Flash->MAC Address) can do this, but it's a manual process.

    [Edit: Keep in mind that once you do this Commit, you need to do a Factory Reset before you can do it again.]

  • Solution: 

    The programming procedure for the MAC address is to write the MAC address directly to the USER_REGn (0x400FE1E0 - 0x400FE1EC). The MAC address format must be written as:-

    1. USER_REG0 ← 0x00CCBBAA (write MAC bytes 0-2)
    2. USER_REG1 ← 0x00FFEEDD (write MAC bytes 3-5)

    Next set the address directly to 0x8000.000(0-3) in the Flash Memory Address (FMA) register (0x400FD000), and finally set the flash write key (0xA442) and the COMT bit (bit-3) in the Flash Memory Controller (FMC) register (0x400FD008) and wait until the COMT bit is cleared.

    MEM 0x400EC040, 8 #read the MAC address location to verify it is empty
    
    W4 0x400FE1E0 0x00CCBBAA #write MAC bytes 0-2 to USER_REG0
    
    W4 0x400FE1E4 0x00DDEEFF #write MAC bytes 3-5 to USER_REG1
    
    MEM 0x400FE1E0, 4 #verify USER_REG0
    
    MEM 0x400FE1E4, 4 #verify USER_REG1
    
    W4 0x400FD000 0x80000000 #write USER_REG0 address to FMA
    
    W4 0x400FD008 0xA4420008 #commit data to USER_REG0 using FMC
    
    W4 0x400FD000 0x80000001 #write USER_REG1 address to FMA
    
    W4 0x400FD008 0xA4420008 #commit data to USER_REG1 using FMC
    
    MEM 0x400EC040, 8 #read the MAC address location to verify programming

**Attention** This is a public forum