Compare commits

...

10 Commits

Author SHA1 Message Date
Arnim Läuger
424b9fbdee
Merge cc6988bc8f into ca79760372 2025-09-01 20:42:17 +02:00
Jonathan Bennett
ca79760372
Add support for the RV-3028 on native Linux (#7802)
Some checks are pending
CI / build-rp2040 (push) Blocked by required conditions
CI / build-rp2350 (push) Blocked by required conditions
CI / build-stm32 (push) Blocked by required conditions
CI / build-debian-src (push) Waiting to run
CI / package-pio-deps-native-tft (push) Waiting to run
CI / test-native (push) Waiting to run
CI / docker-deb-amd64 (push) Waiting to run
CI / docker-deb-amd64-tft (push) Waiting to run
CI / docker-alp-amd64 (push) Waiting to run
CI / docker-alp-amd64-tft (push) Waiting to run
CI / docker-deb-arm64 (push) Waiting to run
CI / docker-deb-armv7 (push) Waiting to run
CI / gather-artifacts (esp32) (push) Blocked by required conditions
CI / gather-artifacts (esp32c3) (push) Blocked by required conditions
CI / gather-artifacts (esp32c6) (push) Blocked by required conditions
CI / gather-artifacts (esp32s3) (push) Blocked by required conditions
CI / gather-artifacts (nrf52840) (push) Blocked by required conditions
CI / gather-artifacts (rp2040) (push) Blocked by required conditions
CI / gather-artifacts (rp2350) (push) Blocked by required conditions
CI / gather-artifacts (stm32) (push) Blocked by required conditions
CI / release-artifacts (push) Blocked by required conditions
CI / release-firmware (esp32) (push) Blocked by required conditions
CI / release-firmware (esp32c3) (push) Blocked by required conditions
CI / release-firmware (esp32c6) (push) Blocked by required conditions
CI / release-firmware (esp32s3) (push) Blocked by required conditions
CI / release-firmware (nrf52840) (push) Blocked by required conditions
CI / release-firmware (rp2040) (push) Blocked by required conditions
CI / release-firmware (rp2350) (push) Blocked by required conditions
CI / release-firmware (stm32) (push) Blocked by required conditions
CI / publish-firmware (push) Blocked by required conditions
2025-08-31 21:08:58 -05:00
Ben Meadors
cc6988bc8f
Merge branch 'master' into rmiiphy_dev 2025-08-20 05:15:56 -05:00
devsaurus
58775b4661 fix trunk check errors 2025-08-16 10:23:53 +02:00
devsaurus
296339351e fix wrongly applied suggestion 2025-08-15 22:51:01 +02:00
Arnim Läuger
5ef83675a3
check ETH.begin() result
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-15 22:46:03 +02:00
devsaurus
72aefbc567 clean up platform.ini 2025-08-15 20:47:15 +02:00
devsaurus
c9a3652021 move to diy 2025-08-15 20:39:33 +02:00
devsaurus
91c1f6fc78 nl 2025-08-15 19:46:18 +02:00
devsaurus
58875acdab Add support for ESP32 RMII PHY, wesp32 variant 2025-08-15 19:41:27 +02:00
21 changed files with 170 additions and 35 deletions

View File

@ -121,13 +121,18 @@ extern "C" void logLegacy(const char *level, const char *fmt, ...);
// Default Bluetooth PIN
#define defaultBLEPin 123456
#if HAS_ETHERNET && !defined(USE_WS5500)
#if HAS_ETHERNET && !(defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY))
#include <RAK13800_W5100S.h>
#endif // HAS_ETHERNET
#if HAS_ETHERNET && defined(USE_WS5500)
#if HAS_ETHERNET
#if defined(USE_WS5500)
#include <ETHClass2.h>
#define ETH ETH2
#endif
#if defined(USE_ESP32_RMIIPHY)
#include <ETH.h>
#endif
#endif // HAS_ETHERNET
#if HAS_WIFI

View File

@ -37,9 +37,14 @@
#include <WiFi.h>
#endif
#if HAS_ETHERNET && defined(USE_WS5500)
#if HAS_ETHERNET
#if defined(USE_WS5500)
#include <ETHClass2.h>
#define ETH ETH2
#endif
#if defined(USE_ESP32_RMIIPHY)
#include <ETH.h>
#endif
#endif // HAS_ETHERNET
#endif

View File

@ -26,10 +26,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <Arduino.h>
#ifdef RV3028_RTC
#if __has_include("Melopero_RV3028.h")
#include "Melopero_RV3028.h"
#endif
#ifdef PCF8563_RTC
#if __has_include("pcf8563.h")
#include "pcf8563.h"
#endif

View File

@ -55,9 +55,9 @@ RTCSetResult readFromRTC()
LOG_DEBUG("Read RTC time from RV3028 getTime as %02d-%02d-%02d %02d:%02d:%02d (%ld)", t.tm_year + 1900, t.tm_mon + 1,
t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, printableEpoch);
timeStartMsec = now;
zeroOffsetSecs = tv.tv_sec;
if (currentQuality == RTCQualityNone) {
timeStartMsec = now;
zeroOffsetSecs = tv.tv_sec;
currentQuality = RTCQualityDevice;
}
return RTCSetResultSuccess;
@ -94,9 +94,9 @@ RTCSetResult readFromRTC()
LOG_DEBUG("Read RTC time from PCF8563 getDateTime as %02d-%02d-%02d %02d:%02d:%02d (%ld)", t.tm_year + 1900, t.tm_mon + 1,
t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, printableEpoch);
timeStartMsec = now;
zeroOffsetSecs = tv.tv_sec;
if (currentQuality == RTCQualityNone) {
timeStartMsec = now;
zeroOffsetSecs = tv.tv_sec;
currentQuality = RTCQualityDevice;
}
return RTCSetResultSuccess;

View File

@ -58,12 +58,12 @@ NimbleBluetooth *nimbleBluetooth = nullptr;
NRF52Bluetooth *nrf52Bluetooth = nullptr;
#endif
#if HAS_WIFI || defined(USE_WS5500)
#if HAS_WIFI || (defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY))
#include "mesh/api/WiFiServerAPI.h"
#include "mesh/wifi/WiFiAPClient.h"
#endif
#if HAS_ETHERNET && !defined(USE_WS5500)
#if HAS_ETHERNET && !(defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY))
#include "mesh/api/ethServerAPI.h"
#include "mesh/eth/ethClient.h"
#endif
@ -421,7 +421,7 @@ void setup()
struct timeval tv;
tv.tv_sec = time(NULL);
tv.tv_usec = 0;
perhapsSetRTC(RTCQualityNTP, &tv);
perhapsSetRTC(RTCQualityDevice, &tv);
#endif
powerMonInit();

View File

@ -25,7 +25,7 @@ template class LR11x0Interface<LR1121>;
template class SX126xInterface<STM32WLx>;
#endif
#if HAS_ETHERNET && !defined(USE_WS5500)
#if HAS_ETHERNET && !(defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY))
#include "api/ethServerAPI.h"
template class ServerAPI<EthernetClient>;
template class APIServerPort<ethServerAPI, EthernetServer>;

View File

@ -3,9 +3,14 @@
#include "ServerAPI.h"
#include <WiFi.h>
#if HAS_ETHERNET && defined(USE_WS5500)
#if HAS_ETHERNET
#if defined(USE_WS5500)
#include <ETHClass2.h>
#define ETH ETH2
#endif
#if defined(USE_ESP32_RMIIPHY)
#include <ETH.h>
#endif
#endif // HAS_ETHERNET
/**

View File

@ -1,7 +1,7 @@
#include "configuration.h"
#include <Arduino.h>
#if HAS_ETHERNET && !defined(USE_WS5500)
#if HAS_ETHERNET && !(defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY))
#include "ethServerAPI.h"

View File

@ -1,7 +1,7 @@
#pragma once
#include "ServerAPI.h"
#ifndef USE_WS5500
#if !(defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY))
#include <RAK13800_W5100S.h>
/**

View File

@ -12,9 +12,14 @@
#include <WebServer.h>
#include <WiFi.h>
#if HAS_ETHERNET && defined(USE_WS5500)
#if HAS_ETHERNET
#if defined(USE_WS5500)
#include <ETHClass2.h>
#define ETH ETH2
#endif
#if defined(USE_ESP32_RMIIPHY)
#include <ETH.h>
#endif
#endif // HAS_ETHERNET
#ifdef ARCH_ESP32

View File

@ -12,9 +12,14 @@
#include <AsyncUDP.h>
#if HAS_ETHERNET && defined(USE_WS5500)
#if HAS_ETHERNET
#if defined(USE_WS5500)
#include <ETHClass2.h>
#define ETH ETH2
#endif
#if defined(USE_ESP32_RMIIPHY)
#include <ETH.h>
#endif
#endif // HAS_ETHERNET
#define UDP_MULTICAST_DEFAUL_PORT 4403 // Default port for UDP multicast is same as TCP api server

View File

@ -10,9 +10,14 @@
#include "target_specific.h"
#include <WiFi.h>
#if HAS_ETHERNET && defined(USE_WS5500)
#if HAS_ETHERNET
#if defined(USE_WS5500)
#include <ETHClass2.h>
#define ETH ETH2
#endif
#if defined(USE_ESP32_RMIIPHY)
#include <ETH.h>
#endif
#endif // HAS_ETHERNET
#include <WiFiUdp.h>
@ -62,13 +67,27 @@ Syslog syslog(syslogClient);
Periodic *wifiReconnect;
#ifdef USE_WS5500
#if defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY)
// Startup Ethernet
bool initEthernet()
{
if ((config.network.eth_enabled) && (ETH.begin(ETH_PHY_W5500, 1, ETH_CS_PIN, ETH_INT_PIN, ETH_RST_PIN, SPI3_HOST,
ETH_SCLK_PIN, ETH_MISO_PIN, ETH_MOSI_PIN))) {
if (config.network.eth_enabled) {
WiFi.onEvent(WiFiEvent);
#if defined(USE_WS5500)
if (!ETH.begin(ETH_PHY_W5500, 1, ETH_CS_PIN, ETH_INT_PIN, ETH_RST_PIN, SPI3_HOST, ETH_SCLK_PIN, ETH_MISO_PIN,
ETH_MOSI_PIN)) {
LOG_ERROR("ETH.begin() failed for WS5500");
return false;
}
#endif
#if defined(USE_ESP32_RMIIPHY)
if (!ETH.begin(ESP32_RMIIPHY_ADDR, ESP32_RMIIPHY_PWR, ESP32_RMIIPHY_MDC, ESP32_RMIIPHY_MDIO, ESP32_RMIIPHY_TYPE,
ESP32_RMIIPHY_CLKTYPE)) {
LOG_ERROR("ETH.begin() failed for ESP32 RMII PHY");
return false;
}
#endif
#if !MESHTASTIC_EXCLUDE_WEBSERVER
createSSLCert(); // For WebServer
#endif
@ -232,7 +251,7 @@ bool isWifiAvailable()
if (config.network.wifi_enabled && (config.network.wifi_ssid[0])) {
return true;
#ifdef USE_WS5500
#if defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY)
} else if (config.network.eth_enabled) {
return true;
#endif
@ -453,14 +472,14 @@ static void WiFiEvent(WiFiEvent_t event)
LOG_INFO("Ethernet disconnected");
break;
case ARDUINO_EVENT_ETH_GOT_IP:
#ifdef USE_WS5500
#if defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY)
LOG_INFO("Obtained IP address: %s, %u Mbps, %s", ETH.localIP().toString().c_str(), ETH.linkSpeed(),
ETH.fullDuplex() ? "FULL_DUPLEX" : "HALF_DUPLEX");
onNetworkConnected();
#endif
break;
case ARDUINO_EVENT_ETH_GOT_IP6:
#ifdef USE_WS5500
#if defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY)
#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)
LOG_INFO("Obtained Local IP6 address: %s", ETH.linkLocalIPv6().toString().c_str());
LOG_INFO("Obtained GlobalIP6 address: %s", ETH.globalIPv6().toString().c_str());

View File

@ -9,9 +9,14 @@
#include <WiFi.h>
#endif
#if HAS_ETHERNET && defined(USE_WS5500)
#if HAS_ETHERNET
#if defined(USE_WS5500)
#include <ETHClass2.h>
#define ETH ETH2
#endif
#if defined(USE_ESP32_RMIIPHY)
#include <ETH.h>
#endif
#endif // HAS_ETHERNET
extern bool needReconnect;
@ -26,7 +31,7 @@ bool isWifiAvailable();
uint8_t getWifiDisconnectReason();
#ifdef USE_WS5500
#if defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY)
// Startup Ethernet
bool initEthernet();
#endif

View File

@ -1176,7 +1176,7 @@ void AdminModule::handleGetDeviceConnectionStatus(const meshtastic_MeshPacket &r
}
#endif
#if HAS_ETHERNET && !defined(USE_WS5500)
#if HAS_ETHERNET && !(defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY))
conn.has_ethernet = true;
conn.ethernet.has_status = true;
if (Ethernet.linkStatus() == LinkON) {

View File

@ -19,9 +19,14 @@
#include "mesh/wifi/WiFiAPClient.h"
#include <WiFi.h>
#endif
#if HAS_ETHERNET && defined(USE_WS5500)
#if HAS_ETHERNET
#if defined(USE_WS5500)
#include <ETHClass2.h>
#define ETH ETH2
#endif
#if defined(USE_ESP32_RMIIPHY)
#include <ETH.h>
#endif
#endif // HAS_ETHERNET
#include "Default.h"
#if !defined(ARCH_NRF52) || NRF52_USE_JSON
@ -309,10 +314,14 @@ bool connectPubSub(const PubSubConfig &config, PubSubClient &pubSub, Client &cli
inline bool isConnectedToNetwork()
{
#ifdef USE_WS5500
#if defined(USE_WS5500)
if (ETH.connected())
return true;
#endif
#if defined(USE_ESP32_RMIIPHY)
if (ETH.linkUp())
return true;
#endif
#if HAS_WIFI
return WiFi.isConnected();

View File

@ -15,7 +15,7 @@
#include <WiFiClientSecure.h>
#endif
#endif
#if HAS_ETHERNET && !defined(USE_WS5500)
#if HAS_ETHERNET && !(defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY))
#include <EthernetClient.h>
#endif

View File

@ -28,7 +28,7 @@
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !MESHTASTIC_EXCLUDE_BLUETOOTH
void setBluetoothEnable(bool enable)
{
#ifdef USE_WS5500
#if defined(USE_WS5500) || defined(USE_ESP32_RMIIPHY)
if ((config.bluetooth.enabled == true) && (config.network.wifi_enabled == false))
#elif HAS_WIFI
if (!isWifiAvailable() && config.bluetooth.enabled == true)

View File

@ -0,0 +1,17 @@
[env:wesp32]
extends = esp32_base
board = esp32dev
board_level = extra
build_flags =
${esp32_base.build_flags}
-D PRIVATE_HW
-I variants/esp32/diy/wesp32
-DMESHTASTIC_EXCLUDE_SCREEN=1
-DMESHTASTIC_EXCLUDE_INPUTBROKER=1
build_src_filter = ${esp32_base.build_src_filter}
monitor_speed = 115200
upload_protocol = esptool
upload_speed = 921600

View File

@ -0,0 +1,54 @@
//
// WESP32, https://wesp32.com/
// ESP-32-WROOM with RTL8201FI/LAN8720 and PoE
//
#define HAS_BUTTON 0
#undef BUTTON_PIN
#undef LED_PIN
#define HAS_SCREEN 0
#define HAS_GPS 0
#undef GPS_RX_PIN
#undef GPS_TX_PIN
// QWIIC connector on Revision 8
#define I2C_SDA 15
#define I2C_SCL 4
#define USE_SX1262
//
// GPIOs on JP1 connected to a Wio-SX1262 (nRF version) LoRa board
//
#define LORA_SCK 33
#define LORA_MISO 35
#define LORA_MOSI 32
#define LORA_CS 5
#define LORA_DIO0 RADIOLIB_NC
#define LORA_RESET 39
#define LORA_DIO1 18
#define LORA_BUSY 13
#define SX126X_DIO1 LORA_DIO1
#define SX126X_BUSY LORA_BUSY
#define SX126X_RESET LORA_RESET
#define SX126X_RXEN 14
#define SX126X_CS LORA_CS
#define SX126X_TXEN RADIOLIB_NC
#define SX126X_DIO2_AS_RF_SWITCH // DIO2 is used to control the TX side of the RF switch
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
#define HAS_ETHERNET 1
// Configure ESP32 RMII PHY
#define USE_ESP32_RMIIPHY
// #define ESP32_RMIIPHY_TYPE ETH_PHY_LAN8720 // Before revision 7
#define ESP32_RMIIPHY_TYPE ETH_PHY_RTL8201 // Revision 7 and later
#define ESP32_RMIIPHY_ADDR 0
#define ESP32_RMIIPHY_PWR -1
#define ESP32_RMIIPHY_MDC 16
#define ESP32_RMIIPHY_MDIO 17
#define ESP32_RMIIPHY_CLKTYPE ETH_CLOCK_GPIO0_IN

View File

@ -3,7 +3,10 @@ extends = portduino_base
build_flags = ${portduino_base.build_flags} -I variants/native/portduino
-I /usr/include
board = cross_platform
lib_deps = ${portduino_base.lib_deps}
lib_deps =
${portduino_base.lib_deps}
melopero/Melopero RV3028@^1.1.0
build_src_filter = ${portduino_base.build_src_filter}
[env:native]

View File

@ -5,3 +5,6 @@
#define HAS_GPS 1
#define MAX_RX_TOPHONE settingsMap[maxtophone]
#define MAX_NUM_NODES settingsMap[maxnodes]
// RAK12002 RTC Module
#define RV3028_RTC (uint8_t)0b1010010