I'm using a TI Concerto (F28M35H52C1) with TI RTOS v2_00_02_36/NDK 2_23_01_01 on a custom board where I need to read the MAC Address out of an EEPROM and then configure NDK to use that MAC Address. I'm able to read the MAC address out of the EEPROM (SPI interface) with no problems, but I'm not able to reconfigure NDK with this MAC address. I've been trying to use the NIMUIoctl() function to change the MAC, but it's returning -1. Here's the code I'm using:
NIMU_IF_REQ if_req;
UINT16 num_device;
int ret_code;
uint8_t mac_address[6];
uint8_t device_name[20];
uint8_t lnIdx = 0;
//Get MAC Address from EEPROM
GetEepromMACAddr(mac_address);
System_printf ("MAC Address from EEPROM : 0x%x:0x%x:0x%x:0x%x:0x%x:0x%x\n",
mac_address[0], mac_address[1], mac_address[2],
mac_address[3], mac_address[4], mac_address[5]);
System_flush();
ret_code = NIMUIoctl (NIMU_GET_NUM_NIMU_OBJ, NULL, &num_device, sizeof(UINT16));
if (ret_code==0)
{
System_printf("Number of NIMU objects:%d\n", num_device);
System_flush();
}
else
{
System_printf ("NIMUIOCTL Failed with error code: %d\n",ret_code);
System_flush();
}
uint16_t device_array[num_device];
ret_code = NIMUIoctl (NIMU_GET_ALL_INDEX, NULL, &device_array, sizeof(device_array));
if (ret_code==0)
{
System_printf("NIMU Index: %d\n", device_array[0]);
System_flush();
}
else
{
System_printf ("NIMUIOCTL Failed with error code: %d\n",ret_code);
System_flush();
}
if_req.index = device_array[0];
ret_code = NIMUIoctl (NIMU_GET_DEVICE_NAME, &if_req, &device_name, sizeof(device_name));
for(lnIdx=0;lnIdx<sizeof(device_name);lnIdx++)
{
if_req.name[lnIdx] = device_name[lnIdx];
}
System_printf ("Device Name : %s\n",if_req.name);
System_flush();
ret_code = NIMUIoctl (NIMU_SET_DEVICE_MAC, &if_req, &mac_address, sizeof(mac_address));
if (ret_code==0)
{
System_printf("NIMU Set MAC Successful\n");
System_flush();
}
else
{
System_printf ("NIMUIOCTL Failed with error code: %d\n",ret_code);
System_flush();
}
ret_code = NIMUIoctl (NIMU_GET_DEVICE_MAC, &if_req, &mac_address, sizeof(mac_address));
System_printf ("MAC Address : 0x%x:0x%x:0x%x:0x%x:0x%x:0x%x\n",
mac_address[0], mac_address[1], mac_address[2],
mac_address[3], mac_address[4], mac_address[5]);
System_flush();
Thanks,
Will