Closed iKK001 closed 3 years ago
Just back home and see you got into this issue
#define USE_WIFI_NINA true
#define USE_WIFI101 false
#define USE_WIFI_CUSTOM false
to
#define USE_WIFI_NINA false
#define USE_WIFI101 true
#define USE_WIFI_CUSTOM false
to use WiFi101 library?
Check if you have the informational warning when you compile the code.
In file included from /home/abcd/Arduino/arduino_working/WiFiManager_Generic_Lite_GitHub/examples/SAMD_WiFi/SAMD_WiFi.ino:27:
/home/abcd/Arduino/arduino_working/WiFiManager_Generic_Lite_GitHub/examples/SAMD_WiFi/defines.h:175:4: warning: #warning Using WiFi101 Library [-Wcpp]
175 | #warning Using WiFi101 Library
Also post the compiler output here so that I can spot if there is something not correct.
#define _WIFI_GENERIC_LOGLEVEL_ 4
So far, I have no idea what's happening without info from you.
void setConfigPortal(String ssid = "", String pass = "");
For example,
WiFiManager_Generic = new WiFiManager_Generic_Lite();
WiFiManager_Generic->setConfigPortal("your_ssid", "your_pwd");
As I don't have the same board, only you can verify and make it working now.
Good Luck,
Thank you for all the hints.
Before I answer your points, I have to state that there is another change needed in your code - otherwise you cannot run on a physical device wihtout Serial Monitor:
Your code sais in SAMD_WiFi.ino, line 76:
while (!Serial);
I changed it to :
while (!Serial && (millis() < 3000));
Otherwise it waits in an endless loop until Serial Monitor is started. And this way, at least after 3 sec the Access Point gets built even if Serial Monitor is OFF...
(And by the way, commenting out DEBUG_WIFI_WEBSERVER_PORT
and WIFI_GENERIC_DEBUG_OUTPUT
inside defines.h does not help with this problem.)
Also, of course, the pinouts I change with the cmd WiFi.setPins(8, 7, 4, 2);
(right as the first line of code inside setup() { ...}
method. As we found out, the Adafruit Feather M0 needs this to work.
And last but not least: I have the following libraries installed via the Arduino Library Manager:
WiFiManager_Generic_Lite Functional-Vlpp DoubleResetDetector_Generic FlashStorage_SAMD WiFi101 WiFiWebServer
The following libraries I did NOT install:
WiFiNINA_Generic ESP_AT_Lib WiFiEspAT ESP8266_AT_WebServer FlashStorage_STM32
As you can see, compared to your original Arduino-Library-complete List - I figured that everything with ESP or Nina does not make sence for my board.
Do you know if I am missing a library still ?
Now that I can run the Code with or without Serial Monitor, I can get to your points:
Here my answers:
1a. Yes, I did change to WiFi101 (instead of NINA) 1b. No, I do not get this particular warning during compile
_WIFI_GENERIC_LOGLEVEL_
to 4):
(as you can see at the very beginning, the BOARD_NAME is SAMD_ZERO
even tough in reality is is a SAMD21-type from Adafruit - hope that is not the issue....)Start SAMD_WiFi on SAMD_ZERO with WINC1500 using WiFi101 Library
WiFiManager_Generic_Lite v1.4.0
[WG] Set CustomsStyle to : <style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>
[WG] Set CustomsHeadElement to : <style>html{filter: invert(10%);}</style>
[WG] Set CORS Header to : Your Access-Control-Allow-Origin
[WG] Hostname=SAMD-WIFIGENERIC-51F485
Flag read = 0xffffffff
No doubleResetDetected
SetFlag write = 0xd0d01234
[WG] CCSum=0xe11e,RCSum=0xffffffff
[WG] ChkCrR:pdata=⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮,len=34
[WG] ChkCrR:pdata=⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮,len=34
[WG] ChkCrR:pdata=⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮,len=34
[WG] ChkCrR:pdata=⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮,len=34
[WG] ChkCrR:pdata=⸮⸮⸮⸮⸮⸮,len=6
[WG] ChkCrR:pdata=⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮,len=34
[WG] ChkCrR:CrCCsum=0xaf50,CrRCsum=0xffffffff
[WG] InitCfgFile,sz=236
[WG] g:myMenuItems[0]=blank
[WG] g:myMenuItems[1]=blank
[WG] g:myMenuItems[2]=blank
[WG] g:myMenuItems[3]=blank
[WG] g:myMenuItems[4]=blank
[WG] g:myMenuItems[5]=blank
[WG] SaveEEPROM,Sz=1024,DataSz=0,WCSum=0xdb3
[WG] pdata=blank,len=34
[WG] pdata=blank,len=34
[WG] pdata=blank,len=34
[WG] pdata=blank,len=34
[WG] pdata=blank,len=6
[WG] pdata=blank,len=34
[WG] CrCCSum=0xc30
[WG] bg: isForcedConfigPortal = false
[WG] bg:Stay forever in CP:No ConfigDat
[WG] Scanning Network
[WG] scanWifiNetworks: Done, Scanned Networks n = 2
[WG] Sorting
[WG] Removing Dup
[WG] WiFi networks found:
[WG] 1: MY_HOME_SSID, -41dB
[WG] 2: DIRECT-B9-HP OfficeJet Pro 6970, -76dB
[WG] SSID=NEW_SSID_DEFINED,PW=12345678
[WG] IP=192.168.4.1,CH=10
[WG] s:configTimeout = 0
F
Your stored Credentials :
Blynk Server1 = blank
Token1 = blank
Blynk Server2 = blank
Token2 = blank
Port = blank
MQTT Server = blank
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
FFFFFFF
One question: If I now use WiFiManager_Generic->setConfigPortal("your_ssid", "your_pwd");
- do I still need to call WiFiManager_Generic->setConfigPortalChannel(0);
as well or not ?
Both do not work without the following two changes (i.e. basically the two identical changes that I had to implement in the WiFiManager_Generic_Lite
SAMD_WiFi.ino in the first place...)
make a timeout in the Serial Monitor, i.e. inside setup() { ... }
method, replace while (!Serial);
by while (!Serial && (millis() < 3000));
change pinout (for Adafruit Feather M0 as compared to the WiFi101 library): i.e. add WiFi.setPins(8, 7, 4, 2);
(right as the first line of code inside setup() { ...}
method.
And of course, for both, I had to enter an SSID and PW. (but that will not be necessary once in play with WiFiManager_Generic_Lite
of course - but only if the WebServer and WiFiWebServer are run standalone).
But now, I cannot use the two libraries as standard since they need these two changes to work. The standard installed is read-only.
I try to reference my new versions of WebServer and WiFiWebServer - but I don't know how or where and I don't know whether this is even needed. Or does WiFiManager_Generic_Lite
automatically does that ????
Are there other libraries referenced by WiFiManager_Generic_Lite
that need to be adapted to the special Feather M0 pinout ?? If yes, which ones ?
Since I don't know what exactly your code is exactly doing, can you please help me with these library-references that seem to need custom libraries ?? And how I reference such a custom library in the first place ??
Also, with the two extra workarrounds needed (i.e. pinout and eventually serial monitor timeout), can you think of anything that would make the Access Point fail ?
Or is it something that I need to set on my iPhone, Android or Mac Browsers in order to get the settings page with http://192.168.4.1 ?
(I get ERR_EMPTY_RESPONSE when trying to connect)
And my very last point: Might be related: With my old Android phone I cannot even connect the Access Point. I am not sure if this is due to the fact that it is an older phone. With my iPhone or Mac I can connect the Access Point (but the http://192.168.4.1 does not work).
That's good you're moving forward, yet still some more things to tackle.
while (!Serial);
The example is just an example to demonstrate the basic feature of the library. The Serial
debug port is intentional and mandatory to debug and understand what's wrong and going on. Please don't expect to be able to use the example as-is in your real use-case, and you have to modify the Serial
code such as you did if you don't need it.
Anyway, I'll add some comment line to inform other un-experienced users about this.
Do you know if I am missing a library still ?
That's all you need. Even adding many more libraries to the to-be-installed list seems to be excessive, it's better that way to help other users, as some don't know which one in necessary, even don't bother to scan thru README to figure out.
This certainly happens because the library has to support too many different kind of boards, wifi modules, platforms, etc.
Start SAMD_WiFi on SAMD_ZERO with WINC1500 using WiFi101 Library
With this, I know you're setting and OK for WiFi101
BOARD_NAME is SAMD_ZERO
Adafruit Feather M0 is actually using same SAMD21 MCU and configurations such as SAMD_ZERO (with minor mods in analog pins).
192.168.4.1
It must be something similar to thisStart SAMD_WiFi on SAMD_NANO_33_IOT with WiFiNINA using WiFiNINA_Generic Library
WiFiManager_Generic_Lite v1.4.0
[WG] Set CustomsStyle to : <style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>
[WG] Set CustomsHeadElement to : <style>html{filter: invert(10%);}</style>
[WG] Set CORS Header to : Your Access-Control-Allow-Origin
[WG] Hostname=SAMD-Master-Controller
Flag read = 0xffffffff
No doubleResetDetected
SetFlag write = 0xd0d01234
...
[WG] SSID=WIFI_GENERIC_51F485,PW=MyWIFI_GENERIC_51F485
[WG] IP=192.168.4.1,CH=5
[WG] s:configTimeout = 0
F
Your stored Credentials :
Blynk Server1 = blank
Token1 = blank
Blynk Server2 = blank
Token2 = blank
Port = blank
MQTT Server = blank
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
======== Displayed only after you've connected successfully to Config Portal ========
[WG] serverSendHeaders:WM_HTTP_CACHE_CONTROL:Cache-Control=no-cache, no-store, must-revalidate
[WG] serverSendHeaders:WM_HTTP_CORS:Access-Control-Allow-Origin : Your Access-Control-Allow-Origin
[WG] serverSendHeaders:WM_HTTP_PRAGMA:Pragma : no-cache
[WG] serverSendHeaders:WM_HTTP_EXPIRES:Expires : -1
[WG] 10 SSIDs found, generating HTML now
[WG] <option>HueNetTek<option>HueNet1<option>HueNet2<option>bacau<option>guest_24<option>rogers786<option>Jasmine<option>Home
[WG] pitem:</head><div style='text-align:left;display:inline-block;min-width:260px;'><fieldset><div><label>*WiFi SSID</label><div><input id='id' list='SSIDs'><datalist id='SSIDs'><option>HueNetTek<option>HueNet1<option>HueNet2<option>bacau<option>guest_24<option>rogers786<option>Jasmine<option>Home</datalist></div></div><div><label>*PWD (8+ chars)</label><input value='[[pw]]' id='pw'><div></div></div><div><label>*WiFi SSID1</label><div>[[input_id1]]</div></div><div><label>*PWD1 (8+ chars)</label><input value='[[pw1]]' id='pw1'><div></div></div></fieldset><fieldset><div><label>Board Name</label><input value='[[nm]]' id='nm'><div></div></div></fieldset>
[WG] pitem:</head><div style='text-align:left;display:inline-block;min-width:260px;'><fieldset><div><label>*WiFi SSID</label><div><input id='id' list='SSIDs'><datalist id='SSIDs'><option>HueNetTek<option>HueNet1<option>HueNet2<option>bacau<option>guest_24<option>rogers786<option>Jasmine<option>Home</datalist></div></div><div><label>*PWD (8+ chars)</label><input value='[[pw]]' id='pw'><div></div></div><div><label>*WiFi SSID1</label><div><input id='id1' list='SSIDs'><datalist id='SSIDs'><option>HueNetTek<option>HueNet1<option>HueNet2<option>bacau<option>guest_24<option>rogers786<option>Jasmine<option>Home</datalist></div></div><div><label>*PWD1 (8+ chars)</label><input value='[[pw1]]' id='pw1'><div></div></div></fieldset><fieldset><div><label>Board Name</label><input value='[[nm]]' id='nm'><div></div></div></fieldset>
[WG] h:HTML page size:2413
[WG] h:HTML=<!DOCTYPE html><html><head><title>SAMD_WM_Lite</title><style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style><style>html{filter: invert(10%);}</style></head><div style='text-align:left;display:inline-block;min-width:260px;'><fieldset><div><label>*WiFi SSID</label><div><input id='id' list='SSIDs'><datalist id='SSIDs'><option>HueNetTek<option>HueNet1<option>HueNet2<option>bacau<option>guest_24<option>rogers786<option>Jasmine<option>Home</datalist></div></div><div><label>*PWD (8+ chars)</label><input value='' id='pw'><div></div></div><div><label>*WiFi SSID1</label><div><input id='id1' list='SSIDs'><datalist id='SSIDs'><option>HueNetTek<option>HueNet1<option>HueNet2<option>bacau<option>guest_24<option>rogers786<option>Jasmine<option>Home</datalist></div></div><div><label>*PWD1 (8+ chars)</label><input value='' id='pw1'><div></div></div></fieldset><fieldset><div><label>Board Name</label><input value='' id='nm'><div></div></div></fieldset><fieldset><div><label>Blynk Server1</label><input value='blank'id='sv1'><div></div></div><div><label>Token1</label><input value='blank'id='tk1'><div></div></div><div><label>Blynk Server2</label><input value='blank'id='sv2'><div></div></div><div><label>Token2</label><input value='blank'id='tk2'><div></div></div><div><label>Port</label><input value='blank'id='prt'><div></div></div><div><label>MQTT Server</label><input value='blank'id='mqt'><div></div></div></fieldset><button onclick="sv()">Save</button></div><script id="jsbin-javascript">function udVal(key,val){var request=new XMLHttpRequest();var url='/?key='+key+'&value='+encodeURIComponent(val);request.open('GET',url,false);request.send(null);}function sv(){udVal('id',document.getElementById('id').value);udVal('pw',document.getElementById('pw').value);udVal('id1',document.getElementById('id1').value);udVal('pw1',document.getElementById('pw1').value);udVal('nm',document.getElementById('nm').value);udVal('sv1',document.getElementById('sv1').value);udVal('tk1',document.getElementById('tk1').value);udVal('sv2',document.getElementById('sv2').value);udVal('tk2',document.getElementById('tk2').value);udVal('prt',document.getElementById('prt').value);udVal('mqt',document.getElementById('mqt').value);alert('Updated');}</script></html>
F
It's better that you use a PC to connect to the Config Portal (CP) because the browsers of Phone are sometimes not designed to work with complex HTMLs.
Also note the IP address of your phone / PC after you connect to the Config Portal SSID and verify that it must be something such as 192.168.4.abc
.
192.168.4.1
IP by using // Optional to change default AP IP(192.168.4.1) and channel(10)
WiFiManager_Generic->setConfigPortalIP(IPAddress(192, 168, 120, 1));
The CP IP now is 192.168.120.1
The following command is also important to avoid channel conflict by using random WiFi channel every time the board is reset
WiFiManager_Generic->setConfigPortalChannel(0);
Good Luck,
Thank you for your detailed answer, I highly appreciate it.
Here my answers:
1) / 2) / 3) --> OK - makes total sense
4-) The reason why you didn't get the debug terminal AFTER I enter 192.168.4.1 in a Windows-PC Browser is that THERE IS ABSOLUTELY NOTHING PRINTED TO THE TERMINAL
5-) Here is my implementation:
WiFiManager_Generic = new WiFiManager_Generic_Lite();
WiFiManager_Generic->setConfigPortal("NEW_SSID_DEFINED", "12345678");
WiFiManager_Generic->setConfigPortalIP(IPAddress(192, 168, 120, 1));
WiFiManager_Generic->setConfigPortalChannel(0);
After connecting with my Windows PC to NEW_SSID_DEFINED Access Point, and go to a Browser entering 192.168.120.1
THERE IS ABSOLUTELY NOTHING PRINTED TO THE TERMINAL - and also the Browser does not show anything. I only get the Error ERR_EMPTY_RESPONSE
inside the Browser.
Something still does not work but I have no idea what it is.
It is as if the Access Point does not send the correct HTML-page content.... Do you have any more idea what to do ?
Sorry you have the issue. I'm afraid there is some incompatibility of the old Adafruit Feather M0 Board with the library.
Without the physical board, there is no way I can find out what's wrong.
It's possible the board hangs up whenever you access the Config Portal => no more Serial printout.
I'm not going to spend any more time on this special rare board. You have to figure out yourself. I'm closing the issue now.
Good Luck,
oh no :(
Can you please recommend a better board that is newer ?
I suggest that you use RP_2040_Connect as they're new and using better-supported WiFiNINA_Generic Library and this library.
The Nano_33_IoT is using the same W102 WiFiNINA, but much older and slower.
I don't know why you go to the not popular and less powerful board? Why not using ESP32-based boards (either from Adafruit or cheaper source)?
thank you - I need to look into the newer boards.
I want to thank you for all the effort in helping out here.
You're very welcome. Hope not anytime in the near future you need help. ;-)
Not sure what I am sitll doing wrong:
I try to get the Access Point working with the WiFiManager_Generic_Lite libarary.
I am using the Adafruit Feather M0 Board.
First I set the pins correctly for this particular board (i.e. in setup() { WiFi.setPins(8, 7, 4, 2); //...}
Second, I set USE_DYNAMIC_PARAMETERS = false (since I do not need dynamic parameters, or do I ?)
Then, after compiling, downloading and starting-up the SAMD_WIFI code, I can see Access Point "WIFI_GENERIC_XXXXXX". Moreover, on my mobile phone, I can connect to the Access Point by entering the Password "MyWIFI_GENERIC_XXXXXX". So far so good.
But then going to my browser on the mobile phone and entering http://192.168.4.1 does not do anything
Two questions:
Why does http://192.168.4.1 not bring up the HTML Mask where I can finally enter the SSID and PW of my Home Network ??
Where exactly in the Code can I change the Access Point Password (from "MyWIFI_GENERIC_XXXXXX" to something else) ??