As the title says... Chat on...

User avatar
By wjr
#60998 Hello, ESP profi community ;-)

sorry for bothering you with my request, but I can't believe that I'm the only one who wants a wired Ethernet connection to his LUA speaking nodeMCU.
Nobody else who
  • was so impressed by the LUA based modules
  • could luckily work through loads of tutorials
  • has many Ideas in mind what to do with them
  • but would really be lucky to connect at least some of them by a decent wire, not by thin WIFI air

This request seems so obvious to me, that I'm afraid that I missed some really simple solution, but nevertheless I dared to place a feature request on the nodemcu firmware issue list:
https://github.com/nodemcu/nodemcu-firmware/issues/1725
I hope this serves as a cristallisation point to attract people being closer to a solution than me.

What I found up to now:
  • software based bit banging solutions, which I don't consider as stable for serius implementations
  • breakout Modules based on the SPI driven enc28j60 chip for less than 3 Euros / Dollars on the known asia source markets
  • some hints to a W5100 chip with many tiny legs, but no breakouts yet
  • two ibraries for the enc28j60 to hook them on the ESP8266
https://github.com/Cicero-MF/esp_enc28j60
https://github.com/UIPEthernet/UIPEthernet

However, those Projects provide a complete flashable firmware - with no LUA in it :-(
I got divorced from the bare metal more than 30 years ago (still coding in bare hexcode, then), so I really would like to access Ethernet wires from the LUA environment.

Probably what I want is a new Module for the enc28j60 in the LUA framwork.

As I understand, we would need three layers of interfacing:
  • towards the existing LUA nodeMCU core, which has already TCP/IP and all that stuff (call it Network stack, right?) for the WIFI, to let the Ethernet module to its daily bit shuffeling work
  • to the existing SPI module for the hardware connectivity
  • on top of the Ethernet lib, to provide some configuration interface like loading/unloading the interface, setting IP address and so on, resembling core funtionalities from the "WIFI" modue or linux tools like "ifconfig" or "ip"

Am I correct so far?
Unfortunately, my C experience is long gone and did not exceed "Hello World" by too much.
I used to code in PERL the last years, since I feel at home at linux platforms.
But I have managed to build some complex software packages outside their native environment, so some grasp of the build mechanisms for larger projects is available.

Is there anybody out to guide me in my endeavour?
Or may be even to point me to a simpler solution Google could not find for me?
User avatar
By wjr
#61012 I spent my afternoon to examine both libraries, the ENC28J80 datasheet and the NodeMCU networking gear.

My impressions:

  • The ENC28J80 handles OSI layer 2 (and by that access to physical layer1, of course). It does not deal with IP adresses or even higher protocol levels.
  • Neither the "UPIP" nor the "Cicero" drivers implement a clean separation of OSI layers, but follow a more hands-on approach of getting the job done.
  • NodeMCU utilizes the lwIP framework http://savannah.nongnu.org/projects/lwip/ as TCP/IP stack implementation, which provides all layer 3 and above services and a clean interface to layer 2 implementations

So maybe it is a better approach to use existing layer 2 implementations (aka drivers ) for the enc28j60 written for lwIP, but for other platforms, than to dismantle hands-on mixed-layered libraries.

From googled results, I selected two candidates for a closer look:


The latter appears to me as the easier, simpler way towards a quicker solution. The first appears to be the cleaner, more matured approach. It uses a clean callback interface to custom SPI implementations, which may help in avoiding conflicts in that corner. What scares me are some references to some "protothread" stuff, but as it looks, this can be configured away.

Looks like I have to setup a NodeMCU build environment now...
User avatar
By devsaurus
#61043 Interesting read, thanks for keeping us updated!

While I have no experience with lwIP at all, I can for sure support you with other aspects of the NodeMCU firmware framework.

I guess you're the one who started https://github.com/nodemcu/nodemcu-firmware/issues/1725? We should move the technical discussion to this issue once you achieved a consolidated view. It will be easier to involve the people with networking expertise.
User avatar
By wjr
#61048
devsaurus wrote:I guess you're the one who started https://github.com/nodemcu/nodemcu-firmware/issues/1725?

Correct, as I stated.

devsaurus wrote:We should move the technical discussion to this issue once you achieved a consolidated view. It will be easier to involve the people with networking expertise


I've been scared by the "governance" issues :-)
But I think it is a good idea to collect only condensed information in the issue tracker.