Unable to connect to SSL servers via ESP32 Airlift

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
anygard
 
Posts: 14
Joined: Tue Jun 15, 2021 3:58 pm

Unable to connect to SSL servers via ESP32 Airlift

Post by anygard »

I have downloaded the custom WifiNINA library provided in the documentation for the ESP32 Airlift breakout board, and I'm attempting to create an HTTP post request to httpbin's https site. Upon launching the WiFiSSLClient, I can connect to Wifi, but I can never connect to the server. I've tried with other secure website URLs, but I've never been able to receive anything back after trying to connect to a server. I can connect to nonsecure servers just fine, but I always get bad requests back from POSTs or GETs. Any ideas as to why this is happening? Below is a transcript of the COM port, my code is just the WiFiSSLClient.cpp with the server and path changed, I'm using an Arduino UNO to provide SPI communication.

Image

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Unable to connect to SSL servers via ESP32 Airlift

Post by mikeysklar »

I believe you need to store the SSL certificate to use https sites with WiFiNina.

https://support.arduino.cc/hc/en-us/art ... 1-Modules-

User avatar
anygard
 
Posts: 14
Joined: Tue Jun 15, 2021 3:58 pm

Re: Unable to connect to SSL servers via ESP32 Airlift

Post by anygard »

I'm working with an Airlift Breakout board, which means that I cannot update SSL headers with the built-in updaters. I haven't had much luck running esptool.py to upload SSL certificates (the recommended firmware updater), so is there a solid way to upload SSL certificates to the board?

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Unable to connect to SSL servers via ESP32 Airlift

Post by mikeysklar »

@anygard,

Were you using the WiFiNINA Firmware updater from the Arduino IDE? Was that what was using esptool.py underneath to move the certificates?

Maybe trying the Secure Connection example from here.

https://learn.adafruit.com/adafruit-air ... 3024982-23

Code: Select all

Note we use WiFiSSLClient client; instead of WiFiClient client; to require an SSL connection!

User avatar
anygard
 
Posts: 14
Joined: Tue Jun 15, 2021 3:58 pm

Re: Unable to connect to SSL servers via ESP32 Airlift

Post by anygard »

I am using an Arduino UNO / Leonardo, which means that I have no native wifi module on board. In turn, the firmware updater will not flash onto the board as the proper libraries for hardware components don't exist for these boards. Because I can't flash the necessary software, I can't upload anything via the WiFiNINA Firmware updater. esptool is a separate tool provided in the documentation that allows you to turn your board into a passthrough module that uses UART or SPI to communicate with the ESP board directly. I'm not sure what you're getting at for the link you posted, I've been using the WiFiSSLClient to try and connect to secure servers, is there something I was missing in that?

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Unable to connect to SSL servers via ESP32 Airlift

Post by mikeysklar »

@anygard,

The secure connection example I linked to above is on from our "Adafruit AirLift - ESP32 WiFi Co-Processor Breakout" guide. It assumes you do not have a built into WiFi native. Here is the link again in case that did not go through correctly.

https://learn.adafruit.com/adafruit-air ... 3024982-23

User avatar
anygard
 
Posts: 14
Joined: Tue Jun 15, 2021 3:58 pm

Re: Unable to connect to SSL servers via ESP32 Airlift

Post by anygard »

This example doesn’t work for other sites because the board doesn’t have the SSL certificates necessary to connect to these secure servers. As soon as you change the host link, you lose all functionality to connect to that server, and the rest of the code doesn’t run. I’ve been using this exact example from the WiFiNINA package I installed from adafruit’s guide. My issue is that this code isn’t expandable since you cannot connect to anything other than adafruit and arduino secure sites. I’m wondering how I could use this example in the future by downloading SSL certificates that I need onto my breakout board.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Unable to connect to SSL servers via ESP32 Airlift

Post by mikeysklar »

Our Adafruit WiFiNiNA should allow you to see your board with the Firmware Updater. However, if your board is not showing up there is another WiFiNiNA_Generic library that has extended support to not only Adafruit boards, but many other chips making it easier to upload SSL certificates.

https://github.com/khoih-prog/WiFiNINA_Generic

User avatar
anygard
 
Posts: 14
Joined: Tue Jun 15, 2021 3:58 pm

Re: Unable to connect to SSL servers via ESP32 Airlift

Post by anygard »

It's not that the Airlift isn't showing up on the firmware updater. You have to flash the parent arduino with a firmware updating code, and that errors out every time I try to flash that onto the arduino. I can send the error messages in a separate post here, as I don't have my board on hand.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Unable to connect to SSL servers via ESP32 Airlift

Post by mikeysklar »

@anygard,

Are the error messages you are seeing from the firmware updater are in regards to uploadign the SSL certificates or actual an actual firmware update? I would expect the firmware update to fail as we have elaborate instructions on how to do that using a pass-thru sketch.

It might make sense for you to give this WiFiNiNA_Generic a try. It appears to have been designed for breakout Airlift and has some good documentation on the github mainpage.

User avatar
anygard
 
Posts: 14
Joined: Tue Jun 15, 2021 3:58 pm

Re: Unable to connect to SSL servers via ESP32 Airlift

Post by anygard »

They are not from the Firmware updater at all. Tools > FirmwareUpdater in the provided examples is a flashable program needed in order to run the firmware updating tool that is built into Arduino. If this is not flashed onto the board, then the firmware updater notifies you that you need to flash this sketch and exits. The errors are stemming from the example.

User avatar
anygard
 
Posts: 14
Joined: Tue Jun 15, 2021 3:58 pm

Re: Unable to connect to SSL servers via ESP32 Airlift

Post by anygard »

Here are the error messages that I got from uploading the firmware updater onto an Arduino Leonardo.

Code: Select all

Arduino: 1.8.15 (Windows 10), Board: "Arduino Leonardo"

ESP32BootROM.cpp:331:32: error: 'SerialNina' was not declared in this scope

 ESP32BootROMClass ESP32BootROM(SerialNina, NINA_GPIO0, NINA_RESETN);

                                ^~~~~~~~~~

C:\Users\dragy\BANNED\Documents\Arduino\libraries\WiFiNINA-master\examples\Tools\FirmwareUpdater\ESP32BootROM.cpp:331:32: note: suggested alternative: 'Serial'

 ESP32BootROMClass ESP32BootROM(SerialNina, NINA_GPIO0, NINA_RESETN);

                                ^~~~~~~~~~

                                Serial

ESP32BootROM.cpp:331:44: error: 'NINA_GPIO0' was not declared in this scope

 ESP32BootROMClass ESP32BootROM(SerialNina, NINA_GPIO0, NINA_RESETN);

                                            ^~~~~~~~~~

ESP32BootROM.cpp:331:56: error: 'NINA_RESETN' was not declared in this scope

 ESP32BootROMClass ESP32BootROM(SerialNina, NINA_GPIO0, NINA_RESETN);

                                                        ^~~~~~~~~~~

C:\Users\dragy\BANNED\Documents\Arduino\libraries\WiFiNINA-master\examples\Tools\FirmwareUpdater\ESP32BootROM.cpp:331:56: note: suggested alternative: 'MSC_RESET'

 ESP32BootROMClass ESP32BootROM(SerialNina, NINA_GPIO0, NINA_RESETN);

                                                        ^~~~~~~~~~~

                                                        MSC_RESET

exit status 1

'SerialNina' was not declared in this scope



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Unable to connect to SSL servers via ESP32 Airlift

Post by mikeysklar »

The firmware updater error I have seen the same issues on another thread with a Leonardo.

https://forum.arduino.cc/t/restore-ardu ... are/632908

It looks like the user was successful by wiping out their Arduino15 appdata.
I had to go into appdata and remove the arduino15 folder
You could try moving your existing Arduino folder to the side and starting with a fresh install.

User avatar
anygard
 
Posts: 14
Joined: Tue Jun 15, 2021 3:58 pm

Re: Unable to connect to SSL servers via ESP32 Airlift

Post by anygard »

Compiler errors like those above haven't completely bricked my Leonardo. I can still flash programs onto it, so deleting appdata wouldn't solve my issue. I tried the WifiGeneric library and was able to flash the FirmwareUpdater onto the board, but not I cannot access the internal flash memory of the esp whenever I try to hit update firmware or upload certificates to wifi module. Many of the solutions out there involve updating SAMD core packages, but I'm using a MEGA32U4 board.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”