Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(EVK) Firmware update fails over WiFi #370

Closed
nseidle opened this issue Jun 19, 2024 · 7 comments
Closed

(EVK) Firmware update fails over WiFi #370

nseidle opened this issue Jun 19, 2024 · 7 comments
Assignees

Comments

@nseidle
Copy link
Member

nseidle commented Jun 19, 2024

Likely related to #369 .

To replicate:

  • Confirm ethernet is not plugged in
  • Factory reset
  • Turn off Ethernet/WiFi failover (currently TCP menu 7, f)
  • Set default network to WiFi (currently TCP menu 7, d)
  • Enter WiFi credentials (6)
  • Exit menus to save settings
  • Update firmware (f, c)

Device fails to even start WiFi. It looks like it's trying to use ethernet.

  Current firmware version: d99.99
  Checking to see if an update is available from https://raw.githubusercontent.com/sparkfun/SparkFun_RTK_Everywhere_Firmware_Binaries/main/RTK-Everywhere-Firmware.json
  [105807][D][HTTPClient.cpp:241] beginInternal(): unexpected protocol: https, expected http
  [105822][D][HTTPClient.cpp:281] beginInternal(): protocol: https, host: raw.githubusercontent.com port: 443 url: /sparkfun/SparkFun_RTK_Everywhere_Firmware_Binaries/main/RTK-Everywhere-Firmware.json
  [105840][D][HTTPClient.cpp:552] sendRequest(): request type: 'GET' redirCount: 0
  
  [105847][E][NetworkManager.cpp:130] hostByName(): DNS Failed for 'raw.githubusercontent.com' with error '-54'
  [105857][E][ssl_client.cpp:116] start_ssl_client(): connect on fd 48, errno: 118, "Host is unreachable"
  [105867][I][NetworkClientSecure.cpp:153] connect(): Actual TLS start postponed.
  [105874][E][NetworkClientSecure.cpp:159] connect(): start_ssl_client: connect failed: -1
  [105882][D][HTTPClient.cpp:1083] connect(): failed connect to raw.githubusercontent.com:443
  [105890][W][HTTPClient.cpp:1399] returnError(): error(-1): connection refused
  [105897][E][NetworkClient.cpp:315] setSocketOption(): fail on 0, errno: 9, "Bad file number"
  [105906][E][NetworkClient.cpp:315] setSocketOption(): fail on 0, errno: 9, "Bad file number"
  [105914][D][HTTPClient.cpp:379] disconnect(): tcp is closed
  
  Firmware server not available
  Failed to get version number from server.
@PaulZC
Copy link
Contributor

PaulZC commented Jul 7, 2024

I'm seeing the same thing when using the Web config on WiFi - in AP mode:

settingName: wifiNetwork_0SSID value: ----
settingName: wifiNetwork_0Password value: ----
settingName: wifiNetwork_1SSID value:
settingName: wifiNetwork_1Password value:
settingName: wifiNetwork_2SSID value:
settingName: wifiNetwork_2Password value:
settingName: wifiNetwork_3SSID value:
settingName: wifiNetwork_3Password value:
settingName: enableRCFirmware value: true
settingName: checkNewFirmware value: 1
Checking for new OTA Pull firmware
sendStringToWebsocket: checkingNewFirmware,1,
Current firmware version: d99.99-Jul  7 2024
Checking to see if an update is available from https://raw.githubusercontent.com/sparkfun/SparkFun_RTK_Everywhere_Firmware_Binaries/main/RTK-Everywhere-RC-Firmware.json
[628423][V][HTTPClient.cpp:230] beginInternal(): url: https://raw.githubusercontent.com/sparkfun/SparkFun_RTK_Everywhere_Firmware_Binaries/main/RTK-Everywhere-RC-Firmware.json
[628448][D][HTTPClient.cpp:241] beginInternal(): unexpected protocol: https, expected http
[628456][V][HTTPClient.cpp:230] beginInternal(): url: https://raw.githubusercontent.com/sparkfun/SparkFun_RTK_Everywhere_Firmware_Binaries/main/RTK-Everywhere-RC-Firmware.json
[628471][D][HTTPClient.cpp:281] beginInternal(): protocol: https, host: raw.githubusercontent.com port: 443 url: /sparkfun/SparkFun_RTK_Everywhere_Firmware_Binaries/main/RTK-Everywhere-RC-Firmware.json
[628489][D][HTTPClient.cpp:552] sendRequest(): request type: 'GET' redirCount: 0

[628497][D][NetworkManager.cpp:83] hostByName(): Clearing DNS cache
[628503][E][NetworkManager.cpp:130] hostByName(): DNS Failed for 'raw.githubusercontent.com' with error '-54'
[628513][V][ssl_client.cpp:68] start_ssl_client(): Free internal heap before TLS 73412
[628520][V][ssl_client.cpp:75] start_ssl_client(): Starting socket (domain 2)
[628528][E][ssl_client.cpp:116] start_ssl_client(): connect on fd 53, errno: 118, "Host is unreachable"
[628537][I][NetworkClientSecure.cpp:153] connect(): Actual TLS start postponed.
[628544][E][NetworkClientSecure.cpp:159] connect(): start_ssl_client: connect failed: -1
[628552][V][ssl_client.cpp:362] stop_ssl_socket(): Cleaning SSL connection.
[628559][D][HTTPClient.cpp:1083] connect(): failed connect to raw.githubusercontent.com:443
[628568][W][HTTPClient.cpp:1399] returnError(): error(-1): connection refused
[628575][E][NetworkClient.cpp:315] setSocketOption(): fail on 0, errno: 9, "Bad file number"
[628583][E][NetworkClient.cpp:315] setSocketOption(): fail on 0, errno: 9, "Bad file number"
[628591][D][HTTPClient.cpp:379] disconnect(): tcp is closed

[628597][V][ssl_client.cpp:362] stop_ssl_socket(): Cleaning SSL connection.
[628603][V][ssl_client.cpp:362] stop_ssl_socket(): Cleaning SSL connection.
Firmware server not available
Sending error to AP config page
sendStringToWebsocket: newFirmwareVersion,ERROR,
Sending receipt confirmation of settings
sendStringToWebsocket: confirmDataReceipt,1,
[628626][D][NVM.ino:155] recordSystemSettingsToFileSD(): Removing from SD: /SFE_EVK_Settings_0.txt
[628732][D][NVM.ino:174] recordSystemSettingsToFileSD(): Settings recorded to SD: /SFE_EVK_Settings_0.txt
[628759][D][NVM.ino:204] recordSystemSettingsToFileLFS(): Removing LittleFS: /SFE_EVK_Settings_0.txt
[628982][D][NVM.ino:216] recordSystemSettingsToFileLFS(): Settings recorded to LittleFS: /SFE_EVK_Settings_0.txt
sendStringToWebsocket: geodeticLat,54.8----,geodeticLon,-1.4----,geodeticAlt,153.582,ecefX,367----.704,ecefY,-9----.042,ecefZ,519----.427,batteryIconFileName,src/BatteryBlank.png,batteryPercent, ,
Provisioning: *PROVISIONING_NOT_STARTED
Provisioning: *PROVISIONING_NOT_STARTED

Checking STN mode now...

@PaulZC
Copy link
Contributor

PaulZC commented Jul 7, 2024

OK. Updating from web config when in STN (WiFi) mode does work. Because WiFi is already up and running when connecting to the SparkFun repo.

otaCheckVersion should be connecting to WiFi if needed - I see wifiConnect in there.

Is the networkGetActiveType perhaps returning the wrong type? It should be returning NETWORK_TYPE_WIFI because we've disabled failover and set the network to WIFI... Is it? Investigating...

@PaulZC
Copy link
Contributor

PaulZC commented Jul 7, 2024

There's a bug in networkGetActiveType. network is never initialized, making type corrupt. Fix coming...

NETWORK_DATA *network;
uint8_t type;
type = network->type;

@PaulZC
Copy link
Contributor

PaulZC commented Jul 7, 2024

Resolved by #411

@PaulZC
Copy link
Contributor

PaulZC commented Jul 7, 2024

This issue isn't fully resolved by #411

With the web config in AP mode:
The firmware version check succeeds, but the firmware update fails with OTA Update: Firmware server not available.

(This requires simultaneous AP and STN. But we know WiFi is capable of that. Investigating...)

@PaulZC
Copy link
Contributor

PaulZC commented Jul 7, 2024

I found a nasty flaw in wifiConnect. It's been there for quite a while. Embarrassing really... Fixed in #412

@PaulZC
Copy link
Contributor

PaulZC commented Jul 7, 2024

This is resolved...

@PaulZC PaulZC assigned PaulZC and unassigned LeeLeahy2 Jul 7, 2024
nseidle added a commit that referenced this issue Jul 8, 2024
Fix error in networkGetActiveType - resolves #370
@nseidle nseidle closed this as completed in 3fd8fa5 Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants