Make sure NWP is stopped before sl_Start

In SDK 1.2.0 TI decided to stop resetting NWP before sl_Start, which in
practice means that sl_start will hang on subsequent runs after the first.

See this post for details and suggested solution:

https://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/p/499123/1806610#1806610

However, since they don't provide OS_debug variant of simplelink.a and
adding another project dependency will complicate our demo even more,
we just take the required bit of code.

PUBLISHED_FROM=c729c0fcbb240aa90a716edd43888de5881d6731
This commit is contained in:
Deomid Ryabkov authored and rojer committed 2016-04-16 10:32:42 +01:00
1 parent 0769bbb7ff
commit 848c884fff
4 files changed
+73 -9

No files matched your search

+11 -5
View File
@@ -50,7 +50,8 @@
#define BM222_ADDR 0x18
#define TMP006_ADDR 0x41
static const char *upload_form = "\
static const char *upload_form =
"\
<h1>Upload file</h1> \
<form action='/upload' method='POST' enctype='multipart/form-data'> \
<input type='file' name='file'> \
@@ -88,8 +89,7 @@ static void mg_ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
("HTTP request from %s: %.*s %.*s", addr, (int) hm->method.len,
hm->method.p, (int) hm->uri.len, hm->uri.p));
if (mg_vcmp(&hm->uri, "/upload") == 0 ||
(mg_vcmp(&hm->uri, "/") == 0 &&
mg_stat("SL:index.html", &st) != 0)) {
(mg_vcmp(&hm->uri, "/") == 0 && mg_stat("SL:index.html", &st) != 0)) {
mg_send(nc, upload_form, strlen(upload_form));
nc->flags |= MG_F_SEND_AND_CLOSE;
break;
@@ -131,14 +131,20 @@ static void mg_ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
static void mg_init(struct mg_mgr *mgr) {
LOG(LL_INFO, ("MG task running"));
stop_nwp(); /* See function description in wifi.c */
int role = sl_Start(0, 0, 0);
if (role < 0) {
LOG(LL_ERROR, ("Failed to start NWP"));
return;
}
LOG(LL_INFO, ("NWP started"));
GPIO_IF_LedToggle(MCU_RED_LED_GPIO);
data_init_sensors(TMP006_ADDR, BM222_ADDR);
sl_fs_init();
sl_Start(NULL, NULL, NULL);
#if defined(WIFI_STA_SSID)
if (!wifi_setup_sta(WIFI_STA_SSID, WIFI_STA_PASS)) {
LOG(LL_ERROR, ("Error setting up WiFi station"));