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.
Tool/software:
Hello forum,
We've designed a custom board for the AM2434 Sitara and are using mcu_plus_sdk_am243x_09_01_00_41 and sysconfig_1.19.0.
We're utilizing CPSW peripherals with two ports, and each port needs to initialize with its own MAC address.
Currently, we initialize the standard settings as follows: the first MAC address is read from the control register (a unique address from TI), and the second one is read from the board EEPROM.
Our customer wants the ability to set their own MAC addresses for the project.
Do you have any suggestions on how to implement the capability to set custom MAC addresses?
Hi Pavel,
I did following, I created my own board.c source file using the syscfg file "ti_board_config-c"..
Then edited following function to:
```c
void EnetBoard_getMacAddrList(uint8_t macAddr[][ENET_MAC_ADDR_LEN],
uint32_t maxMacEntries,
uint32_t *pAvailMacEntries)
{
int32_t status = ENET_SOK;
uint32_t val;
uint32_t macAddrCnt;
uint8_t numMacMax = ENET_BOARD_NUM_MACADDR_USED;
CSL_main_ctrl_mmr_cfg0Regs *mmrRegs;
EnetAppUtils_assert(ENET_GET_NUM_MAC_ADDR(numMacMax) <= ENET_BOARD_NUM_MACADDR_MAX);
EnetAppUtils_assert(pAvailMacEntries != NULL);
*pAvailMacEntries = ENET_BOARD_NUM_MACADDR_USED;
/*Get first MAC Address from Fuses*/
mmrRegs = (CSL_main_ctrl_mmr_cfg0Regs *)(uintptr_t)CSL_CTRL_MMR0_CFG0_BASE;
val = CSL_REG32_RD(&mmrRegs->MAC_ID0);
macAddr[0][5] = (uint8_t)((val & 0x000000FFU) >> 0U);
macAddr[0][4] = (uint8_t)((val & 0x0000FF00U) >> 8U);
macAddr[0][3] = (uint8_t)((val & 0x00FF0000U) >> 16U);
macAddr[0][2] = (uint8_t)((val & 0xFF000000U) >> 24U);
val = CSL_REG32_RD(&mmrRegs->MAC_ID1);
macAddr[0][1] = (uint8_t)((val & 0x000000FFU) >> 0U);
macAddr[0][0] = (uint8_t)((val & 0x0000FF00U) >> 8U);
/*Get second MAC Address from EEPROM*/
status = FactoryData_getMACAddressBytes(&macAddr[1][0], ENET_MAC_ADDR_LEN);
EnetAppUtils_assert(status == ENET_SOK);
/* Verify */
EnetAppUtils_print("Recognized Mac addresses: \r\n");
for(uint8_t k = 0; k < numMacMax; k++){
for (uint8_t i = 0; i < ENET_MAC_ADDR_LEN; i++){
EnetAppUtils_print("%02x:", macAddr[k][i]);
}
EnetAppUtils_print("\r\n");
}
macAddrCnt = EnetUtils_min(ENET_GET_NUM_MAC_ADDR(numMacMax), maxMacEntries);
if (macAddrCnt == 0U)
{
EnetAppUtils_print("EnetBoard_getMacAddrList Failed - IDK not present \r\n");
EnetAppUtils_assert(false);
}
}
```
FactoryData_getMacAddressBytes being a function to take out the address out of our custom eeprom not beeing from ti.
Regards,
Isaac
Thanks for the reply. I have the following question: The function in question is called from the SDK. The init function is EnetApp_driverOpen
, which goes deeper into the SDK and uses EnetSoc_getEFusedMacAddrs
and EnetBoard_getMacAddrList
. Where should I call my custom function?
Hello again,
before doing that it is necessary to select in your syscfg under Enet(CPSW or ICSS) under "Board Config"->"Custom Board". Make sure you save a copy of "ti_board_config.c" before doing that.
Then you should create a custom source file called "board". The build system should detect this.
After that you can just copy paste the source of "ti_board_config.c" into board.c. There you can rewrite the function "EnetBoard_getMacAddrList"
Wow! Thanks a lot. I didn't notice this checkbox. You saved me time, thank you very much.