Struggling to get Webserver to work

29 Dec 2021, 9am

Color me discouraged. I present this as what may be a “parting gift”, to alert those who have the energy to follow after me to some of the things that I think would have prevented success, had I found all of the “ingredients” to make my project work.

I an new to Wio Terminal… and loving it… in particular for the great documentation and online tutorials, etc. Essential part of any “good” product.

But Ii’m failing miserably to get the webserver to work, in even the simplest way. (I have managed to get the Wio Terminal to tell me what WiFi SSIDs are “around”! Not entirely incompetent!)

Webservers are not trivial beasts. But I’ve been doing them for years. I even have some working on the WiFi in question already. (8266 servers. See Arduserver.com) I have some idea. (Please don’t tell me “try turning the others off”. If Wio Terminal webserver can’t “play nicely” with others, it is no use to me. I have more than one webserver on the WiFi. I see no (good) reason why “more that one plus one” should be a big ask.)

So… below is what I’ve done so far… I think… What Am I missing!!!


As instructed, I have (I think) updated all boards and libraries to the current state as of 29 Dec 2021, 8am. Including:

WiFiWebServer_RTL8720, which I now have in vers 1.0.1.
“Seeed SAMD Boards”: vers 1.8.2

I have the libraries called for in the online guide… and the code compiles, and “runs”. Early on, it hangs in a loop… but it “runs”.


I’ve tried… it took a day (not fun)… to “update the firmware for the Realtek RTL8720 Wireless core on the Wio Terminal”, as called for at “Overview - Seeed Wiki

I think I finally succeeded.

QUESTION: At the end of that, (at “Check RTL8720 Firmware Version from Arduino IDE”) it gives a short sketch to retrieve the version of the firmware now in the chip… what version should it be, if the update succeeded??


Tried running the simple Webserver example again, with my few “minor” (they all say that!) diagnostic "Serial.println"s shown below…

On each restart, it hangs for a long time… consistently about 20 seconds it seems (actually 18-22 seconds the times I’ve timed it.) (Timing it is a pain because Serial Monitor has to be stopped, restarted, each time Wio Terminal reset… see notes in the code.)

It hangs for that acceptable but tedious time at…

WiFi.begin(ssid, password);

… and then goes into…

while (WiFi.status() != WL_CONNECTED)

… and doesn’t come out before I give up waiting… 5 minutes and more, if I go make a new cup of tea.

My tweaked code…

void setup(void) {
   pinMode(led, OUTPUT);
   digitalWrite(led, 0);
   Serial.begin(115200);
   //while(!Serial); // Wait to open Serial Monitor  << N.B. ADDED. (Seen in Seeed code " CheckRTL8720Firmware")
   //   BAD idea... will "hang" Terminal, if it isn't connected to Serial Monitor
   delay(6000);//To give user time to re-start serial monitor after WiioTermional restarted
   //Pull Wio Terminal off/on/reset button down. Should get audible confirmation of loss of connection.
   //Close any existing Serial Monitor window.
   //Prepare to restart Serial Monitor with icon, upper right, maing Arduino IDE window.
   //Release off/on/rest
   //Wait for "beedle-deep" to finish.
   //Click to restart Serial Monitor.
   //If delay less than 6000, you may miss the Serial.Print that follows the
   //  (irrelevant to these issues, I think) "Wifi.mode..."

   WiFi.mode(WIFI_STA);//Set it to connect to a router. Takes no time.
   Serial.println("Trying to connect to WiFi");//Added by TKB

   //Next two come from https://www.arduino.cc/en/Tutorial/LibraryExamples/WiFiNINAConnectWithWPA/... but I'm not using WiFiNINA.
   //if (WiFi.status() == WL_NO_MODULE) {
   //  Serial.println("Communication with WiFi module failed!");

  WiFi.begin(ssid, password);//TKB poke and hope...
  //WiFi.begin("aug06bah","d557909e76");//hangs here for long time... 60 sec?
  Serial.println("WiFi.begin completed2");//Added by TKB
  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    if (WiFi.status()==WL_NO_SHIELD){Serial.println("WL_NO_SHIELD");}//assigned when no WiFi shield is present
    if (WiFi.status()==WL_CONNECT_FAILED){Serial.println("WL_CONNECT_FAILED");}//assigned when the connection fails for all the attempts
    if (WiFi.status()==WL_NO_SSID_AVAIL){Serial.println("WL_NO_SSID_AVAIL");}//assigned when no SSID are available
    delay(500);
    Serial.print(".");
    }
 Serial.print("Connected to ");
 Serial.println(ssid);
 Serial.print("IP address: ");

Trying to connect to a WPA2 Personal encrypted AP. Changed my old password because it, by chance, only held hex-valid characters. (Thought that might cause the Wio Terminal to try to connect via WEP, which my AP doesn’t offer.)

Made sure AP was broadcasting SSID.

Ideas? Has ANYONE got a Wio Terminal “doing” webserving, even “just” to their WiFi LAN???


This is the latest firmware library version


Running the wiki’s code example after flashing the firmware also works without problems. What you need to make sure is that all the required libraries are installed to the latest version as required by the wiki.

image




image