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.

TM4C1294NCPDT UIP例程 MAC地址如何设置,有何规则??

Other Parts Discussed in Thread: TM4C1294NCPDT

如题。。。

  • 参考如下代码:

    //
    // Read the MAC address from the user registers.
    //
    MAP_FlashUserGet(&ui32User0, &ui32User1);
    if((ui32User0 == 0xffffffff) || (ui32User1 == 0xffffffff))
    {
    //
    // We should never get here. This is an error if the MAC address has
    // not been programmed into the device. Exit the program.
    //
    UpdateStatus("MAC Address Not Programmed!");
    while(1)
    {
    }
    }

    //
    // Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC
    // address needed to program the hardware registers, then program the MAC
    // address into the Ethernet Controller registers.
    //
    sTempAddr.addr[0] = ((ui32User0 >> 0) & 0xff);
    sTempAddr.addr[1] = ((ui32User0 >> 8) & 0xff);
    sTempAddr.addr[2] = ((ui32User0 >> 16) & 0xff);
    sTempAddr.addr[3] = ((ui32User1 >> 0) & 0xff);
    sTempAddr.addr[4] = ((ui32User1 >> 8) & 0xff);
    sTempAddr.addr[5] = ((ui32User1 >> 16) & 0xff);

  • 看楼上贴出的代码,是通过设置ui32User0,ui32User0的值来来吧设置的值给sTempAddr.addr这个数组的。

    然后再把sTempAddr.addr的值写进相应的寄存器中。用的是EMACAddrSet这个函数应该是。

  • 我想问下,tm4c1294ncpdt  芯片在出厂时 ,预先将mac地址烧入了 user0  和 user1  寄存器吗?

  • 我看过好几块芯片都是没有mac地址的,出厂应该没有预先烧录。

  • 你是怎么看的呢?出厂应该是有默认的了。

  • 看user0  和 user1  寄存器,均是FF

  • 0xff也是有值的,试试能不能ping通了。

  • 看二楼的代码,如果都是FF程序就死了,还ping什么。

  • 如果读回来是0XFF,那说明你的MAC地址没有设置。只能重新设置了,但是确实出厂的时候应该有默认MAC地址的。应该是你擦除的时候连flash中的数据也擦除了。用户寄存器中的数据清空了。