From 22d13014a03c7ee33f9f9c8f94c4ed78d7b58602 Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 18 Feb 2020 03:23:12 -0800 Subject: [PATCH] Fix bug that sets pin 10 to INPUT on WiFi boards netConnectionState being initialized to NetworkConnectionState::DISCONNECTED caused the WiFiNINA library's SpiDrv::end() to be called before SpiDrv::begin(). Since SLAVESELECT is initialized to 10, and only assigned SPIWIFI_SS in SpiDrv::begin(), this causes pin 10 to be set to INPUT. Since pin 10 is MISO on the MKR boards, and often used as CS on the Nano 33 IoT, and WiFiConnectionHandler::update() is typically called from loop(), after SPI has already been configured, this breaks communication on SPI. --- src/Arduino_ConnectionHandler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Arduino_ConnectionHandler.h b/src/Arduino_ConnectionHandler.h index 4b0edb55..5162dcf9 100644 --- a/src/Arduino_ConnectionHandler.h +++ b/src/Arduino_ConnectionHandler.h @@ -162,7 +162,7 @@ class ConnectionHandler { _on_error_event_callback = NULL; unsigned long lastValidTimestamp = 0; /* UNUSED */ - NetworkConnectionState netConnectionState = NetworkConnectionState::DISCONNECTED; + NetworkConnectionState netConnectionState = NetworkConnectionState::INIT; static void execNetworkEventCallback(OnNetworkEventCallback & callback, void * callback_arg);