Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: SYSBIOS
Hello All,
This problem I am facing is related to https://e2e.ti.com/support/microcontrollers/other/f/908/t/766896,
Using MAC address in flash
ti.sysbios.family.arm.m3.Hwi: line 143: E_alreadyDefined: Hwi already defined: intr# 56
00000.000 ExecStart: Already Open
00000.000 DHCPOpen: NIMUIOCTL (NIMU_GET_DEVICE_MAC) Failed with error code: -22
void netStart() {
//debug("NetStart Callback\r\n");
}
void netStop() {
//debug("NetStop Callback\r\n");
}
void serviceReport(uint a, uint b, uint c, HANDLE cfg) {
//debug("ServiceReport\r\n");
}
void openConnections(IPN IPAddr, uint IfIdx, uint fAdd);
char *hostname = "myhost";
Void configIpInitDHCP(HANDLE hCfg)
{
debug("CONFIGURANDO DHCP\r\n");
/* Add our global hostname to hCfg (to be claimed in all connected domains) */
CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0,
strlen(hostname),
(UINT8 *)hostname, 0);
/* Use DHCP to obtain IP address on interface 1 */
{
CI_SERVICE_DHCPC dhcpc;
UINT8 DHCP_OPTIONS[] =
{
DHCPOPT_SUBNET_MASK,
};
/* Specify DHCP Service on IF specified by "IfIdx" */
bzero(&dhcpc, sizeof(dhcpc));
dhcpc.cisargs.Mode = 1;
dhcpc.cisargs.IfIdx = 1;
dhcpc.cisargs.pCbSrv = &serviceReport;
dhcpc.param.pOptions = DHCP_OPTIONS;
dhcpc.param.len = 1;
CfgAddEntry(hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_DHCPCLIENT, 0,
sizeof(dhcpc), (UINT8 *)&dhcpc, 0);
}
}
Void configIpInitStatic(HANDLE hCfg)
{
RemottaConfig *rc = getRemottaConfig();
char *DomainName = "scientt.scom";
char ipAddress[20], netmask[20], gateway[20];
debug("CONFIGURANDO STATIC IP\r\n");
/* Add our global hostname to hCfg (to be claimed in all connected domains) */
CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0,
strlen(hostname),
(UINT8 *)hostname, 0);
/* Configure IP address manually on interface 1 */
{
CI_IPNET NA;
CI_ROUTE RT;
/* Setup manual IP address */
bzero(&NA, sizeof(NA));
getStringAddressFromInt(rc->configData.ethParam.ipAddress, ipAddress);
getStringAddressFromInt(rc->configData.ethParam.networkMask, netmask);
NA.IPAddr = inet_addr(ipAddress);
NA.IPMask = inet_addr(netmask);
strcpy(NA.Domain, DomainName);
NA.NetType = 0;
CfgAddEntry(hCfg, CFGTAG_IPNET, 1, 0,
sizeof(CI_IPNET), (UINT8 *)&NA, 0);
/*
* Add the default gateway. Since it is the default, the
* destination address and mask are both zero (we go ahead
* and show the assignment for clarity).
*/
bzero(&RT, sizeof(RT));
RT.IPDestAddr = 0;
RT.IPDestMask = 0;
getStringAddressFromInt(rc->configData.ethParam.gateway, gateway);
RT.IPGateAddr = inet_addr(gateway);
CfgAddEntry(hCfg, CFGTAG_ROUTE, 0, 0,
sizeof(CI_ROUTE), (UINT8 *)&RT, 0);
}
}
Void configUdpInit(HANDLE hCfg)
{
{
Int receiveBufSize = 2048;
CfgAddEntry(hCfg, CFGTAG_IP, CFGITEM_IP_SOCKUDPRXLIMIT,
CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&receiveBufSize, 0);
}
}
Void configTcpInit(HANDLE hCfg)
{
{
Int transmitBufSize = 2048;
CfgAddEntry(hCfg, CFGTAG_IP, CFGITEM_IP_SOCKTCPTXBUF,
CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&transmitBufSize, 0);
}
{
Int receiveBufSize = 2048;
CfgAddEntry(hCfg, CFGTAG_IP, CFGITEM_IP_SOCKTCPRXBUF,
CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&receiveBufSize, 0);
}
{
Int receiveBufLimit = 2048;
CfgAddEntry(hCfg, CFGTAG_IP, CFGITEM_IP_SOCKTCPRXLIMIT,
CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&receiveBufLimit, 0);
}
}
extern void llTimerTick();
int NetworkConfig(void)
{
int ret;
HANDLE hCfg;
RemottaConfig *rc = getRemottaConfig();
Clock_Params clockParams;
debug("\r\nNetworkConfig Configuracion - Initialization\r\nNC_SystemOpen\r\n");
/* Create the NDK heart beat */
Clock_Params_init(&clockParams);
clockParams.startFlag = TRUE;
clockParams.period = 100;
Clock_create(&llTimerTick, clockParams.period, &clockParams, NULL);
ret = NC_SystemOpen( NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT );
if( ret )
{
sprintf(_message, "NC_SystemOpen Failed (%d)\n",ret);
debug(_message);
return -1;
}
hCfg = CfgNew();
if( !hCfg )
{
debug("Unable to create configuration\n");
goto main_exit;
}
NC_NetStop(0);
if (rc->configData.ethParam.dhcpOrStatic == DHCP) {
configIpInitDHCP(hCfg);
}
else {
configIpInitStatic(hCfg);
}
configTcpInit(hCfg);
configUdpInit(hCfg);
/* add the configuration settings for NDK low priority tasks stack size. */
int stackSize = 1024;
CfgAddEntry(hCfg, CFGTAG_OS, CFGITEM_OS_TASKSTKLOW,
CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&stackSize, 0 );
/* add the configuration settings for NDK norm priority tasks stack size. */
stackSize = 1024;
CfgAddEntry(hCfg, CFGTAG_OS, CFGITEM_OS_TASKSTKNORM,
CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&stackSize, 0 );
/* add the configuration settings for NDK high priority tasks stack size. */
stackSize = 1024;
CfgAddEntry(hCfg, CFGTAG_OS, CFGITEM_OS_TASKSTKHIGH,
CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&stackSize, 0 );
//
// Boot the system using this configuration
//
// We keep booting until the function returns less than 1. This allows
// us to have a "reboot" command.
//
debug("NC_NetStart\r\n");
do
{
ret = NC_NetStart( hCfg, netStart, netStop, openConnections );
} while( ret > 0 );
sprintf(_message, "NC_NetStart retCode = %d\r\n", ret);
debug(_message);
// Delete Configuration
CfgFree( hCfg );
debug("NetworkConfig Configuracion - Finishing\r\n");
// Close the OS
main_exit:
NC_SystemClose();
return(0);
}
Void startupTask(UArg arg0, UArg arg1) {
// Code before
NetworkConfig();
// Code after
}
Tks in advance
Leandro
