-
Notifications
You must be signed in to change notification settings - Fork 11
Modifications for ESP32. Unstable #2
base: master
Are you sure you want to change the base?
Conversation
w5500-lwIP.cpp
Outdated
{ | ||
uint8_t zeros[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
if (!macAddress) | ||
macAddress = zeros; | ||
|
||
if (!Wiznet5500::begin(macAddress)) | ||
if (!Wiznet5500::begin(spi, macAddress)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you also modified Wiznet api ?
@@ -4,7 +4,7 @@ | |||
#include <IPAddress.h> | |||
|
|||
#include <lwip/netif.h> | |||
#include <lwip/etharp.h> | |||
#include <netif/etharp.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What version of lwIP is the esp32 using ? is it 1.4 ?
w5500-lwIP.cpp
Outdated
* NETIF_FLAG_ETHARP and/or NETIF_FLAG_ETHERNET flag! | ||
*/ | ||
err_t | ||
netif_input(struct pbuf *p, struct netif *inp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is normally part of lwIP (1 / 2). Why is it needed here ?
w5500-lwIP.cpp
Outdated
|
||
#ifdef ESP8266 | ||
if (phy_capture) | ||
phy_capture(ths->_netif.num, (const char*)pbuf->payload, pbuf->len, /*out*/1, /*success*/len == pbuf->len); | ||
#endif | ||
|
||
return len == pbuf->len? ERR_OK: ERR_MEM; | ||
//return len == pbuf->len? ERR_OK: ERR_MEM; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something must be returned here
w5500-lwIP.cpp
Outdated
//if (p->len != p->tot_len) | ||
// Serial.printf("Chained : p->len=%d p->tot_len=%d\r\n", p->len, p->tot_len); | ||
|
||
do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think chained pbufs must be unchained prior to sending the full frame.
A fragmented pbuf in this function is a continous frame (ethernet packet) splitted into parts.
sendFrame expects a valid monolithic ethernet packet.
IPAddress localIP () const { return IPAddress(_netif.ip_addr.addr); } | ||
IPAddress subnetMask () const { return IPAddress(_netif.netmask.addr); } | ||
IPAddress gatewayIP () const { return IPAddress(_netif.gw.addr); } | ||
IPAddress localIP () const { return IPAddress(_netif.ip_addr.u_addr.ip4.addr); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does esp32 support IPv6 (then is using lwIP-v2)?
if that's so then there are lwIP macro to abstract the IPv4 address in a IPv4/IPv6 compatible way
I think it is ip4_addr_get_u32(&_netif.{ip_addr,netmask,gw})
(see <lwip>/include/ip4_addr.h
)
Bug : Driver stop working as soon as we etablish a WiFi connexion.
# Conflicts: # w5500-lwIP.cpp # w5500-lwIP.h
First patch for ESP32 MCU. Unstable.