
Help! I am trying to use the Arduino WiFi101 library to connect to an existing SSL server. For troubleshooting - I'm actually connecting to www.howsmyssl.com. Whether I use the IP address or the host name, the connection fails every time. The board I am using is the Adafruit Feather M0 Wifi. I used the Firmware Updater to upload the certificate for www.howsmyssl.com to the board. Here is the code:
#include <stdint.h> #include <WiFi101.h> #include <stdlib.h> WiFiSSLClient client; char ssid[] = "SciAv"; char pass[] = "FlyAcclaim"; void setup() { WiFi.setPins(8,7,4,2); while ( WiFi.begin(ssid, pass) != WL_CONNECTED) { Serial.println("Connecting to SciAv"); delay(10000); } Serial.println("WiFi Connected"); if (!client.connectSSL("www.howsmyssl.com",443)) { Serial.println("Connection Failed"); } else { Serial.println("Connected"); } } void loop() { if (client.connected()) { Serial.println("Connect to host"); } }
2 Answers
I have the same problem with the NANO33 IoT board. I found that an SSL connect failed on a board with the latest microcode (revision 1.4.8), but worked on a board with back-level microcode (revision 1.2.3). Just swapping out the NANO33 board makes the problem show up or go away. Reflash the microcode to a working back-level version if you need an SSL internet connection, or wait for Arduino to fix their bug in the next microcode release. Arduino WiFiNINA library used was version 1.8.13.
You verificate if the certificate upload succefully on the board? Because to connect a ssl connection the shield needs be loaded with the ssl certificate. You can try add this verification before the Wifi network connection:
// check for the presence of the shield: if (WiFi.status() == WL_NO_SHIELD) { Serial.println("WiFi shield not present"); // don't continue: while (true); }
Alternatively, you can try using method 'connect("www.howsmyssl.com",443)' instead of 'connectSSL..'. This is useful If you have a library that accepts only plain Client, but you want to force it to use SSL, keeping the same method names of the non SSL client.
4ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobXBuY2yCcXyOmqmdrZmjvG7DyJ%2BgamhhYrCwus2emq2ro6F6p63IpapmrJ9isLC6zZ6arQ%3D%3D