Other Parts Discussed in Thread: SYSCONFIG
Hi,
H/w: CC3220S Launchpad for dev though a custom board also exists.
I am migrating a project which ran successfully using SDK2.3 over to the latest SDK (4.4) and tools (CCS10.2, SysConfig) so it can be upgraded with new features.
It is based on the httpget example and uses TI-RTOS. I make use of the TI-RTOS static configurator to create 3xTASKS, 4xCLK instances and 1xSemaphore.
All seems to have gone quite well and it compiles, links and runs (a little) before crashing. I've used ROV to capture 'Before Running' and 'After Running' diagnostic info. From this it looks like I'm already in trouble before even running with the Semaphore status (see 'Before Running' screen capture below) . It should use only one semaphore called 'BufferReady' but it appears to show many (with some uninitialised). I've cleaned the project but same result. There is an 'After Running' capture too which shows an exception however where this exception occurs isn't consistent. I believe this is likely a memory issue but I'm not sure how to proceed to find the cause. I have 'HeapTrack' enabled and I don't see any other kind of errors (like Stackoverflow),
One thing that I'm not clear on is the mix of POSIX and TI-RTOS, in particular how I've enabled my own tasks. I've modified the platform.c file in httpget such that instead of creating the httpthread=>httptask when a successful IP is acquired, I have simply changed the priority of my lead task from -1 to 2 using Task_setPri(Task_HalfDuplexStateMchHandle, 2); Snippet below along with screen captures. Any inputs most welcome! I'm tempted to try and use a native TI-RTOS solution not just to save memory and decrease some latency but I'm just more comfortable in that 'TI-RTOS' only environment.
In project httpget in platform.c I've removed code in red and replaced with code in blue:
void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent)
{
int32_t status = 0;
// pthread_attr_t pAttrs;
// struct sched_param priParam;
if(pNetAppEvent == NULL)
{
return;
}
Display_printf(display, 0, 0, "Valid SL event\n\r");
switch(pNetAppEvent->Id)
{
case SL_NETAPP_EVENT_IPV4_ACQUIRED:
case SL_NETAPP_EVENT_IPV6_ACQUIRED:
/* Initialize SlNetSock layer with CC3x20 interface */
status = ti_net_SlNet_initConfig();
if(0 != status)
{
Display_printf(display, 0, 0, "Failed to initialize SlNetSock\n\r");
}
if(mode != ROLE_AP)
{
Display_printf(display, 0, 0,"[NETAPP EVENT] IP Acquired: IP=%d.%d.%d.%d , "
"Gateway=%d.%d.%d.%d\n\r",
SL_IPV4_BYTE(pNetAppEvent->Data.IpAcquiredV4.Ip,3),
SL_IPV4_BYTE(pNetAppEvent->Data.IpAcquiredV4.Ip,2),
SL_IPV4_BYTE(pNetAppEvent->Data.IpAcquiredV4.Ip,1),
SL_IPV4_BYTE(pNetAppEvent->Data.IpAcquiredV4.Ip,0),
SL_IPV4_BYTE(pNetAppEvent->Data.IpAcquiredV4.Gateway,3),
SL_IPV4_BYTE(pNetAppEvent->Data.IpAcquiredV4.Gateway,2),
SL_IPV4_BYTE(pNetAppEvent->Data.IpAcquiredV4.Gateway,1),
SL_IPV4_BYTE(pNetAppEvent->Data.IpAcquiredV4.Gateway,0));
sl_WlanPolicySet(SL_WLAN_POLICY_PM, SL_WLAN_ALWAYS_ON_POLICY, NULL, 0); // For minimal latency
Task_setPri(Task_HalfDuplexStateMchHandle, 2); // Enable Half Duplex State Machine task
/*
pthread_attr_init(&pAttrs);
priParam.sched_priority = 1;
status = pthread_attr_setschedparam(&pAttrs, &priParam);
status |= pthread_attr_setstacksize(&pAttrs, TASK_STACK_SIZE);
status = pthread_create(&httpThread, &pAttrs, httpTask, NULL);
if(status)
{
printError("Task create failed", status);
}
*/
}
break;
default:
break;
}
}
Before Running
After Running
rgds,
Stuart