Other Parts Discussed in Thread: SYSBIOS, CC3200
Hi all,
I am using CC3235SF for making an IoT application. I am utilizing the Network processor to get the scan results using the following code:
if (!_initialized) { init(); } const int WLAN_SCAN_COUNT = 30; int iRet; // // make sure the connection policy is not set (so no scan is run in the background) // iRet = sl_WlanPolicySet(SL_WLAN_POLICY_CONNECTION, SL_WLAN_CONNECTION_POLICY(0, 0, 0, 0), NULL, 0); if(iRet != 0) { sl_WlanPolicySet(SL_WLAN_POLICY_CONNECTION, SL_WLAN_CONNECTION_POLICY(1,1,0,0), NULL, 0); return 0; } uint32_t intervalInSeconds = 10; //min is 10 sec iRet = sl_WlanPolicySet(SL_WLAN_POLICY_SCAN , SL_WLAN_SCAN_POLICY(1,0), (uint8_t*) &intervalInSeconds, sizeof(intervalInSeconds)); if(iRet != 0) { sl_WlanPolicySet(SL_WLAN_POLICY_CONNECTION , SL_WLAN_CONNECTION_POLICY(1,1,0,0), NULL, 0); return 0; } delay(900); // wait for the net list SlWlanNetworkEntry_t found_networks[WLAN_SCAN_COUNT]; //memset(&found_networks, 0, sizeof(found_networks)); network_count = sl_WlanGetNetworkList(0, (unsigned char)WLAN_SCAN_COUNT, &found_networks[0]); // // disable scan // sl_WlanPolicySet(SL_WLAN_POLICY_SCAN, SL_WLAN_DISABLE_SCAN, NULL, 0); sl_WlanPolicySet(SL_WLAN_POLICY_CONNECTION , SL_WLAN_CONNECTION_POLICY(1,1,0,0), NULL, 0); //(1,1,0,0) return network_count;
and also another function in order to be called after the scan and print the results for each network found from the list:
//function: for getting each SSID for each net
if (!_initialized) { init(); } // //get the network list and return the ssid of the requested index // if (networkItem >= network_count) { return NULL; } // //fetch all 20 items. For some reason, fetching a single item doesn't work // SlWlanNetworkEntry_t netInfo[network_count]; memset(&netInfo, 0, sizeof(netInfo)); sl_WlanGetNetworkList(0, network_count, (SlWlanNetworkEntry_t*)&netInfo); strcpy(string_output_buffer, (char*)netInfo[networkItem].Ssid); return string_output_buffer;
//===========================================
//function: for getting each BSSID for each net
if (!_initialized) { init(); } // //get the network list and return the ssid of the requested index // if (networkItem >= network_count) { return NULL; } // //fetch all 20 items. For some reason, fetching a single item doesn't work // SlWlanNetworkEntry_t netInfo[network_count]; memset(&netInfo, 0, sizeof(netInfo)); sl_WlanGetNetworkList(0, network_count, (SlWlanNetworkEntry_t*)&netInfo); memcpy(string_output_buffer2, netInfo[networkItem].Bssid, BSSID_LEN); return string_output_buffer2;
//=================================
//function: for getting the RSSI value for each net
if (!_initialized) { init(); } // //get the network list and pull out the security type of the requested item // if (networkItem >= network_count) { return 0; } // //fetch all 20 items. For some reason, fetching a single item doesn't work // SlWlanNetworkEntry_t netInfo[network_count]; memset(&netInfo, 0, sizeof(netInfo)); sl_WlanGetNetworkList(0, network_count, (SlWlanNetworkEntry_t*)&netInfo); return (int32_t)netInfo[networkItem].Rssi;
For some reason, that I am still investigating, some times the code crashes while trying to get the netInfo scan list.
Therefore, I am trying to incorporate the watchdog into my implementation in order to be able to reset the system when this happens.
I am using the driverlib/wdt.h and the watchdog in implemented as followed:
//initialize the watchdog MAP_PRCMPeripheralClkEnable(PRCM_WDT, PRCM_RUN_MODE_CLK); MAP_WatchdogUnlock(WDT_BASE); MAP_IntPrioritySet(INT_WDT, INT_PRIORITY_LVL_1); MAP_WatchdogIntRegister(WDT_BASE,&WatchdogIntHandler); MAP_WatchdogReloadSet(WDT_BASE,MILLISECONDS_TO_TICKS(WD_PERIOD_MS)); MAP_WatchdogEnable(WDT_BASE); ... //Wdt handler void WatchdogIntHandler(void) { MAP_WatchdogIntClear(WDT_BASE); }
However, the watchdog is showing unexpected behavior regarding the network processor (I tried it with a non-WiFi example and worked fine). In particular, if the code crashes, the reset is not always invoked by the watchdog.
The watchdog resets both the MCU and the Network processor right?
Is there any known issue regarding the watchdog working with the network processor?
Thanks a lot!
Artemis