Hi Experts,
I am using NDK module for TM4C129NCPDT target board and TM4c129x evolution kit. Below is the snippet of code. What I found is that the code is working fine in evolution kit but in the target board it seems the NDK is not been initialized properly. What is the cause for this ?( Please find the log snippet) Please notes the difference between the evolution kit and target kit is ... the MAC address is already configured in the board but in the target board I have set in function EK_TM4C1294XL_initEMAC().
uint32_t ulUser0, ulUser1;
ulUser0 = 0x00c7d352;
ulUser1 = 0x0060be06;
LOG SNIPPET:
Using MAC address in flash ulUser0 c7d352, ulUser0 60be05
Service Status: DHCPC : Enabled : : 000
Service Status: DHCPC : Enabled : Running : 000
1439251200 ................// First trace...
1439251201 taskService Status: DHCPC : Enabled : Fault : 002
CODE SNIPPET:
Int main(void)
{
setIpAddress( "192.168.1.155"); //for http for local
setHostName("someaddress.com");
setHttpPortNr(8080);
Board_initGeneral();
Board_initGPIO();
Board_initEMAC();//----------------- Calls EK_TM4C1294XL_initEMAC
Board_initSDSPI();
//Set system clock
if(!systemClockSet) {
systemClockSet = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); // 120000000); 120 Mhz
}
/* Call board init functions */
//Board_initGeneral();
/* Create a Semaphore object for task lock*/
taskLock = Semaphore_create(1, NULL, NULL);
BIOS_start(); ----------------- reads the Configurations files(*.cfg) and Spans netIPAddrHook
return (0);
}
void EK_TM4C1294XL_initEMAC(void)
{
uint32_t ulUser0, ulUser1;
ulUser0 = 0x00c7d352;
ulUser1 = 0x0060be06;
FlashUserSet(ulUser0, ulUser1);
/* Get the MAC address */
FlashUserGet(&ulUser0, &ulUser1); //52:d3:c7:06:be:60
if ((ulUser0 != 0xffffffff) && (ulUser1 != 0xffffffff)) {
System_printf("\nUsing MAC address in flash ulUser0 %x, ulUser0 %x",ulUser0,ulUser1);
/*
* 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.
*/
macAddress[0] = ((ulUser0 >> 0) & 0xff);
macAddress[1] = ((ulUser0 >> 8) & 0xff);
macAddress[2] = ((ulUser0 >> 16) & 0xff);
macAddress[3] = ((ulUser1 >> 0) & 0xff);
macAddress[4] = ((ulUser1 >> 8) & 0xff);
macAddress[5] = ((ulUser1 >> 16) & 0xff);
}
else if (macAddress[0] == 0xff && macAddress[1] == 0xff &&
macAddress[2] == 0xff && macAddress[3] == 0xff &&
macAddress[4] == 0xff && macAddress[5] == 0xff) {
macAddress[0] = ((ulUser0 >> 0) & 0xff);
macAddress[1] = ((ulUser0 >> 8) & 0xff);
macAddress[2] = ((ulUser0 >> 16) & 0xff);
macAddress[3] = ((ulUser1 >> 0) & 0xff);
macAddress[4] = ((ulUser1 >> 8) & 0xff);
macAddress[5] = ((ulUser1 >> 16) & 0xff);
System_printf("\nSet MAC address in flash, %x, %x\n",ulUser0, ulUser1 );
//System_abort("Change the macAddress variable to match your boards MAC sticker");
}
GPIOPinConfigure(GPIO_PF0_EN0LED0); /* EK_TM4C1294XL_USR_D3 */
GPIOPinConfigure(GPIO_PF4_EN0LED1); /* EK_TM4C1294XL_USR_D4 */
GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_4);
/* Once EMAC_init is called, EMAC_config cannot be changed */
EMAC_init();
}
Snippet of CFG files
/* ================ NDK configuration ================ */
var Ndk = xdc.loadPackage('ti.ndk.config');
var Global = xdc.useModule('ti.ndk.config.Global');
var Tcp = xdc.useModule('ti.ndk.config.Tcp');
Global.IPv6 = false;
Global.stackLibType = Global.MIN;
Global.networkIPAddrHook = "&netIPAddrHook";
/* automatically call fdOpen/CloseSession for our sockets Task */
Global.autoOpenCloseFD = true;
Global.pktNumFrameBufs = 10;
Global.memRawPageCount = 6;
Global.ndkThreadStackSize = 4096;
Global.lowTaskStackSize = 2048;
Global.normTaskStackSize = 4096;
Global.highTaskStackSize = 8192;
Tcp.transmitBufSize = 2048;
Tcp.receiveBufSize = 2048;
__________________________
void netIPAddrHook(unsigned int IPAddr, unsigned int IfIdx, unsigned int fAdd)
{
static Task_Handle taskHandle;
Task_Params taskParams;
Error_Block eb;
logg("create httpProcTask", __FUNCTION__);flush();
if (fAdd && !taskHandle) {
Error_init(&eb);
Task_Params_init(&taskParams);
taskParams.stackSize = 32*1024;
taskParams.priority = 1;
taskHandle = Task_create((Task_FuncPtr)httpProc, &taskParams, &eb);
if (taskHandle == NULL) {
//System_printf("\nnetIPAddrHook: Failed to create httpProcTask\n");System_flush();
logg("failed to create httpProcTask", __FUNCTION__);
}
}
}