mirror of https://github.com/arendst/Tasmota.git
Change ESP32 Ethernet Phy Type number for ETH_PHY_DM9051 from 4 to 10 (#21204)
This commit is contained in:
parent
370f59dd40
commit
e95c940345
|
@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
|
|||
### Changed
|
||||
- ESP32 Framework (Arduino Core) from v2.0.15 to v3.0.0 (#21180)
|
||||
- ESP32 Core3 platform update from 2024.04.11 to 2024.04.12 (#21199)
|
||||
- ESP32 Ethernet Phy Type number for ETH_PHY_DM9051 from 4 to 10 (#21204)
|
||||
|
||||
### Fixed
|
||||
- HASPmota dropdown class "options" attribute (#21203)
|
||||
|
@ -548,7 +549,7 @@ All notable changes to this project will be documented in this file.
|
|||
- `BrRestart` now supports web handlers to work after Berry restart
|
||||
|
||||
### Removed
|
||||
- Support for ESP32-C3 with chip rev below 3 (old development boards)
|
||||
- Support for ESP32-C3 with chip revision below 0.3 (old development boards)
|
||||
|
||||
## [13.0.0] 20230626
|
||||
- Release Qasim
|
||||
|
|
|
@ -156,6 +156,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
|||
- KNX format of energy to match specifications [#21074](https://github.com/arendst/Tasmota/issues/21074)
|
||||
- ESP32 refactored Wifi for ESP32 Core3 release [#21106](https://github.com/arendst/Tasmota/issues/21106)
|
||||
- ESP32 WiFi phy modes 11n and 11ax represented as HT20, HT40 and HE20 [#19350](https://github.com/arendst/Tasmota/issues/19350)
|
||||
- ESP32 Ethernet Phy Type number for ETH_PHY_DM9051 from 4 to 10 (#21204)[#21204](https://github.com/arendst/Tasmota/issues/21204)
|
||||
- berry.exe (pre-compiled for Windows) updated to latest Berry patches [#21024](https://github.com/arendst/Tasmota/issues/21024)
|
||||
- Berry class `int64` made immutable [#20727](https://github.com/arendst/Tasmota/issues/20727)
|
||||
- Matter reduce memory usage when reading with wildcards [#20809](https://github.com/arendst/Tasmota/issues/20809)
|
||||
|
|
|
@ -1139,15 +1139,15 @@ https://rya.nc/tasmota-fingerprint.html"
|
|||
|
||||
//#define USE_ETHERNET // Add support for ethernet (+20k code)
|
||||
// #define USE_WT32_ETH01 // Add support for Wireless-Tag WT32-ETH01
|
||||
// #define ETH_TYPE 0 // [EthType] 0 = ETH_PHY_LAN8720, 1 = ETH_PHY_TLK110/ETH_PHY_IP101, 2 = ETH_PHY_RTL8201, 3 = ETH_PHY_DP83848, 4 = ETH_PHY_DM9051, 5 = ETH_PHY_KSZ8081
|
||||
// #define ETH_TYPE 0 // [EthType] 0 = ETH_PHY_LAN8720, 1 = ETH_PHY_TLK110/ETH_PHY_IP101, 2 = ETH_PHY_RTL8201, 3 = ETH_PHY_DP83848, 4 = ETH_PHY_RFU, 5 = ETH_PHY_KSZ8081, 6 = ETH_PHY_KSZ8041, 7 = ETH_PHY_JL1101, 8 = ETH_PHY_W5500, 9 = ETH_PHY_KSZ8851, 10 = ETH_PHY_DM9051
|
||||
// #define ETH_ADDRESS 1 // [EthAddress] 0 = PHY0 .. 31 = PHY31
|
||||
// #define ETH_CLKMODE 0 // [EthClockMode] 0 = ETH_CLOCK_GPIO0_IN, 1 = ETH_CLOCK_GPIO0_OUT, 2 = ETH_CLOCK_GPIO16_OUT, 3 = ETH_CLOCK_GPIO17_OUT
|
||||
// Olimex ESP32-PoE
|
||||
#define ETH_TYPE 0 // [EthType] 0 = ETH_PHY_LAN8720, 1 = ETH_PHY_TLK110/ETH_PHY_IP101, 2 = ETH_PHY_RTL8201, 3 = ETH_PHY_DP83848, 4 = ETH_PHY_DM9051, 5 = ETH_PHY_KSZ8081
|
||||
#define ETH_TYPE 0 // [EthType] 0 = ETH_PHY_LAN8720, 1 = ETH_PHY_TLK110/ETH_PHY_IP101, 2 = ETH_PHY_RTL8201, 3 = ETH_PHY_DP83848, 4 = ETH_PHY_RFU, 5 = ETH_PHY_KSZ8081, 6 = ETH_PHY_KSZ8041, 7 = ETH_PHY_JL1101, 8 = ETH_PHY_W5500, 9 = ETH_PHY_KSZ8851, 10 = ETH_PHY_DM9051
|
||||
#define ETH_ADDRESS 0 // [EthAddress] 0 = PHY0 .. 31 = PHY31
|
||||
#define ETH_CLKMODE 3 // [EthClockMode] 0 = ETH_CLOCK_GPIO0_IN, 1 = ETH_CLOCK_GPIO0_OUT, 2 = ETH_CLOCK_GPIO16_OUT, 3 = ETH_CLOCK_GPIO17_OUT
|
||||
// wESP32-PoE
|
||||
// #define ETH_TYPE 0 // [EthType] 0 = ETH_PHY_LAN8720, 1 = ETH_PHY_TLK110/ETH_PHY_IP101, 2 = ETH_PHY_RTL8201, 3 = ETH_PHY_DP83848, 4 = ETH_PHY_DM9051, 5 = ETH_PHY_KSZ8081
|
||||
// #define ETH_TYPE 0 // [EthType] 0 = ETH_PHY_LAN8720, 1 = ETH_PHY_TLK110/ETH_PHY_IP101, 2 = ETH_PHY_RTL8201, 3 = ETH_PHY_DP83848, 4 = ETH_PHY_RFU, 5 = ETH_PHY_KSZ8081, 6 = ETH_PHY_KSZ8041, 7 = ETH_PHY_JL1101, 8 = ETH_PHY_W5500, 9 = ETH_PHY_KSZ8851, 10 = ETH_PHY_DM9051
|
||||
// #define ETH_ADDRESS 0 // [EthAddress] 0 = PHY0 .. 31 = PHY31
|
||||
// #define ETH_CLKMODE 0 // [EthClockMode] 0 = ETH_CLOCK_GPIO0_IN, 1 = ETH_CLOCK_GPIO0_OUT, 2 = ETH_CLOCK_GPIO16_OUT, 3 = ETH_CLOCK_GPIO17_OUT
|
||||
|
||||
|
|
|
@ -78,11 +78,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef ETH_TYPE
|
||||
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||
#define ETH_TYPE ETH_PHY_LAN8720 // ETH.h eth_phy_type_t: 0 = ETH_PHY_LAN8720, 1 = ETH_PHY_TLK110/ETH_PHY_IP101, 2 = ETH_PHY_RTL8201, 3 = ETH_PHY_JL1101, 4 = ETH_PHY_DP83848, 5 = ETH_PHY_KSZ8041, 6 = ETH_PHY_KSZ8081, 7 = ETH_PHY_DM9051, 8 = ETH_PHY_W5500, 9 = ETH_PHY_KSZ8851
|
||||
#else
|
||||
#define ETH_TYPE ETH_PHY_LAN8720 // ETH.h eth_phy_type_t: 0 = ETH_PHY_LAN8720, 1 = ETH_PHY_TLK110/ETH_PHY_IP101, 2 = ETH_PHY_RTL8201, 3 = ETH_PHY_DP83848, 4 = ETH_PHY_DM9051, 5 = ETH_PHY_KSZ8041, 6 = ETH_PHY_KSZ8081, 7 = ETH_PHY_JL1101
|
||||
#endif
|
||||
#define ETH_TYPE ETH_PHY_LAN8720 // ETH.h eth_phy_type_t: 0 = ETH_PHY_LAN8720, 1 = ETH_PHY_TLK110/ETH_PHY_IP101, 2 = ETH_PHY_RTL8201, 3 = ETH_PHY_DP83848, 4 = ETH_PHY_RFU, 5 = ETH_PHY_KSZ8081, 6 = ETH_PHY_KSZ8041, 7 = ETH_PHY_JL1101, 8 = ETH_PHY_W5500, 9 = ETH_PHY_KSZ8851, 10 = ETH_PHY_DM9051
|
||||
#endif
|
||||
|
||||
#ifndef ETH_CLKMODE
|
||||
|
@ -92,6 +88,19 @@
|
|||
|
||||
#include <ETH.h>
|
||||
|
||||
const uint8_t eth_type_xtable[] = {
|
||||
0, // 0 = ETH_PHY_LAN8720
|
||||
1, // 1 = ETH_PHY_TLK110/ETH_PHY_IP101
|
||||
2, // 2 = ETH_PHY_RTL8201
|
||||
4, // 3 = ETH_PHY_DP83848 (is 4 in core3)
|
||||
0, // 4 = ETH_TYPE_RFU - Future Use
|
||||
6, // 5 = ETH_PHY_KSZ8081
|
||||
5, // 6 = ETH_PHY_KSZ8041
|
||||
3, // 7 = ETH_PHY_JL1101
|
||||
8, // 8 = ETH_PHY_W5500 (is new in core3 and using SPI)
|
||||
9, // 9 = ETH_PHY_KSZ8851 (is new in core3 and using SPI)
|
||||
7 // 10 = ETH_PHY_DM9051 (is 7 in core3 and using SPI)
|
||||
};
|
||||
char eth_hostname[sizeof(TasmotaGlobal.hostname)];
|
||||
uint8_t eth_config_change;
|
||||
|
||||
|
@ -106,23 +115,6 @@ void EthernetEvent(arduino_event_t *event) {
|
|||
break;
|
||||
|
||||
case ARDUINO_EVENT_ETH_CONNECTED:
|
||||
#ifdef USE_IPV6
|
||||
#if ESP_IDF_VERSION_MAJOR < 5 // not needed anymore after Core3 esp-idf 5.1
|
||||
ETH.enableIPv6(); // enable Link-Local
|
||||
// workaround for the race condition in LWIP, see https://github.com/espressif/arduino-esp32/pull/9016#discussion_r1451774885
|
||||
{
|
||||
uint32_t i = 5; // try 5 times only
|
||||
while (esp_netif_create_ip6_linklocal(get_esp_interface_netif(ESP_IF_ETH)) != ESP_OK) {
|
||||
delay(1);
|
||||
if (i-- == 0) {
|
||||
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ETH ">>>> HELP"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // USE_IPV6
|
||||
|
||||
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ETH D_CONNECTED " at %dMbps%s, Mac %s, Hostname %s"),
|
||||
ETH.linkSpeed(), (ETH.fullDuplex()) ? " Full Duplex" : "",
|
||||
ETH.macAddress().c_str(), eth_hostname
|
||||
|
@ -195,12 +187,12 @@ void EthernetSetIp(void) {
|
|||
void EthernetInit(void) {
|
||||
if (!Settings->flag4.network_ethernet) { return; }
|
||||
|
||||
int eth_type = Settings->eth_type;
|
||||
int eth_type = eth_type_xtable[Settings->eth_type];
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC
|
||||
if (WT32_ETH01 == TasmotaGlobal.module_type) {
|
||||
Settings->eth_address = 1; // EthAddress
|
||||
Settings->eth_type = ETH_PHY_LAN8720; // EthType
|
||||
Settings->eth_clk_mode = ETH_CLOCK_GPIO0_IN; // EthClockMode
|
||||
Settings->eth_type = 0; // EthType 0 = ETH_PHY_LAN8720
|
||||
Settings->eth_clk_mode = 0; // EthClockMode 0 = ETH_CLOCK_GPIO0_IN
|
||||
}
|
||||
#else // No CONFIG_ETH_USE_ESP32_EMAC
|
||||
if (Settings->eth_type < 7) {
|
||||
|
@ -235,13 +227,10 @@ void EthernetInit(void) {
|
|||
int eth_power = Pin(GPIO_ETH_PHY_POWER); // Ethernet SPI RST
|
||||
|
||||
#ifdef USE_IPV6
|
||||
#if ESP_IDF_VERSION_MAJOR >= 5 // this seemed to cause a crash with Core2 when the call is made early
|
||||
ETH.enableIPv6(); // enable Link-Local
|
||||
#endif // ESP_IDF_VERSION_MAJOR >= 5
|
||||
#endif // USE_IPV6
|
||||
|
||||
bool init_ok = false;
|
||||
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||
if (Settings->eth_type < 7) {
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC
|
||||
init_ok = (ETH.begin((eth_phy_type_t)eth_type, Settings->eth_address, eth_mdc, eth_mdio, eth_power, (eth_clock_mode_t)Settings->eth_clk_mode));
|
||||
|
@ -252,9 +241,6 @@ void EthernetInit(void) {
|
|||
SPI.begin(Pin(GPIO_SPI_CLK), Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_MOSI), -1);
|
||||
init_ok = (ETH.begin((eth_phy_type_t)eth_type, Settings->eth_address, eth_mdc, eth_mdio, eth_power, SPI, ETH_PHY_SPI_FREQ_MHZ));
|
||||
}
|
||||
#else
|
||||
init_ok = (ETH.begin(Settings->eth_address, eth_power, eth_mdc, eth_mdio, (eth_phy_type_t)Settings->eth_type, (eth_clock_mode_t)Settings->eth_clk_mode));
|
||||
#endif // ESP_IDF_VERSION_MAJOR >= 5
|
||||
if (!init_ok) {
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_ETH "Bad EthType or init error"));
|
||||
return;
|
||||
|
@ -359,7 +345,7 @@ void CmndEthAddress(void) {
|
|||
}
|
||||
|
||||
void CmndEthType(void) {
|
||||
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 8)) {
|
||||
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < sizeof(eth_type_xtable))) {
|
||||
Settings->eth_type = XdrvMailbox.payload;
|
||||
TasmotaGlobal.restart_flag = 2;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue