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 -4
View File
@@ -42,7 +42,8 @@
#include "wifi.h"
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'> \
@@ -80,8 +81,7 @@ 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;
@@ -114,7 +114,14 @@ 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"));
sl_Start(0, 0, 0);
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"));
sl_fs_init();