Skip to content

Commit

Permalink
nRF52: bringup of Wi-Fi 'co-processor' with 'Esp-AT' firmware
Browse files Browse the repository at this point in the history
  • Loading branch information
lyusupov committed Mar 14, 2024
1 parent 9324976 commit 82f7e20
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
9 changes: 8 additions & 1 deletion software/firmware/source/SoftRF/src/driver/WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,16 @@ void WiFi_setup()
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
// while (true);
return;
}

#if !defined(_WIFI_ESP_AT_H_)
String fv = WiFi.firmwareVersion();
if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
Serial.println("Please upgrade the firmware");
}
#endif /* _WIFI_ESP_AT_H_ */

WiFi.setHostname(host_name.c_str());

Expand Down Expand Up @@ -340,7 +343,11 @@ void WiFi_fini()
Uni_Udp.stop();

#if defined(USE_ARDUINO_WIFI)
#if !defined(_WIFI_ESP_AT_H_)
WiFi.end();
#else
WiFi.endAP();
#endif /* _WIFI_ESP_AT_H_ */
#else
WiFi.mode(WIFI_OFF);
#endif /* USE_ARDUINO_WIFI */
Expand Down
11 changes: 10 additions & 1 deletion software/firmware/source/SoftRF/src/platform/nRF52.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,10 @@ static void nRF52_setup()

#if defined(USE_TINYUSB)
Serial1.setPins(SOC_GPIO_PIN_CONS_RX, SOC_GPIO_PIN_CONS_TX);
#if defined(EXCLUDE_WIFI)
Serial1.begin(SERIAL_OUT_BR, SERIAL_OUT_BITS);
#endif
#endif /* EXCLUDE_WIFI */
#endif /* USE_TINYUSB */

digitalWrite(SOC_GPIO_PIN_IO_PWR, HIGH);
pinMode(SOC_GPIO_PIN_IO_PWR, OUTPUT); /* VDD_POWR is ON */
Expand Down Expand Up @@ -813,6 +815,13 @@ static void nRF52_setup()
#if defined(USE_TINYUSB) && defined(USBCON)
for (int i=0; i < 20; i++) {if (Serial) break; else delay(100);}
#endif

#if !defined(EXCLUDE_WIFI)
#if defined(_WIFI_ESP_AT_H_)
Serial1.begin(115200);
WiFi.init(&Serial1);
#endif /* _WIFI_ESP_AT_H_ */
#endif /* EXCLUDE_WIFI */
}

static void nRF52_post_init()
Expand Down
2 changes: 1 addition & 1 deletion software/firmware/source/SoftRF/src/platform/nRF52.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ struct rst_info {
//#define USE_ARDUINO_WIFI
//#define USE_WIFI_NINA false
//#define USE_WIFI_CUSTOM true
//#include <WiFiNINA.h>
//#include <WiFiEspAT.h>
//#define Serial_setDebugOutput(x) ({})
//#define WIFI_STA_TIMEOUT 20000

Expand Down

0 comments on commit 82f7e20

Please sign in to comment.