Skip to content
This repository has been archived by the owner on Dec 23, 2020. It is now read-only.

Modifications for ESP32. Unstable #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Modifications for ESP32. Unstable #2

wants to merge 5 commits into from

Conversation

psykokwak-com
Copy link

First patch for ESP32 MCU. Unstable.

@psykokwak-com psykokwak-com mentioned this pull request Jun 12, 2018
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))
Copy link
Owner

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>
Copy link
Owner

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)
Copy link
Owner

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;
Copy link
Owner

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
Copy link
Owner

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); }
Copy link
Owner

@d-a-v d-a-v Jun 12, 2018

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)

Jean Charles Mammana added 3 commits June 13, 2018 09:22
Bug : Driver stop working as soon as we etablish a WiFi connexion.
# Conflicts:
#	w5500-lwIP.cpp
#	w5500-lwIP.h
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants