Welcome! Log In Create A New Profile


Duet WiFi Socket Server ESP8266 firmware and SDK version

Posted by gloomyandy 
Duet WiFi Socket Server ESP8266 firmware and SDK version
February 10, 2020 02:36PM
I'm not sure if this is the right place for this, but it seems as good a place as any....

The current Duet Wifi Socket Server firmware (which runs on andESP8266 board) makes use of a customised version of the ESP8266 Arduino Core and LWIP2 stack, along with some libraries from the Espressif ESP8266 SDK. The base code and Espressif SDK is not the most recent and Espressif has stated that they no longer plan to update the v2.x SDK which is currently used. They have said that they do intended to maintain the v3.x SDK (which is the current release), but are moving away from this. I thought it might be an interesting exercise to try and update things to use more recent versions of things and basically this is a report of my progress to date.

First step was to grab a copy of the latest ESP8266 Arduino core (which now comes with the LWIP2 stack) and to modify it to...
1. Have build options/configuration etc. that match those used for the Duet code.
2. Build libs rather than compiling the code every time.
I basically hacked some makefiles and managed to get this working in a new fork of the ESP8266 Arduino code that in effect replaces DC42's ESP8266Core and LwipESP8266 repos. This means it is possible to make use of the more recent framework SDK (2.6.3) and this should be easier to update to more recent builds as they are made. Oh and the Arduino core code also includes pretty much all the tools that you need (or at least has a mechanism to pull them), so the cross-compiler and other tools all get installed (so no more having to use the Arduino IDE to get them).

This version of the core framework is still using an older version of the Espressif SDK (by default it uses V2.2.x from July last year). The Arduino core does have support for an early pre-release of the V3 SDK but that is not used due to some issues with reduced memory availability (and possibly some other problems). The Arduino ESP8266 team are working on support for the V3 SDK but have not given details of when it will be available. I was curious as to if things could be made to work with the current V3.02 SDK release and so added the needed support for partitions and pulled (the slightly modified) libs from the SDK into my fork. Much to my surprise after a few changes I had a WiFi server running based on this combination. So far it seems pretty stable.

A few notes on the changes I've made....
1. My version of the WiFi server code is based on sdavi's fork so it has a reduced number of sockets and other changes to allow it to work with the LPC port of RRF. I'm not sure if this has any impact on how well things work, but it would be pretty easy to build a standard version of the code.
2. I've made a few changes to the WiFi server source to allow it to build with the updated core/lwip2 code, but I've tried to keep these to a minimum, there are almost certainly better ways to change the code, but it would require larger changes.
3. I've changed the build mechanism to make use of a makefile rather then the eclipse build system, it was easier for me to keep track of my changes this way.
The current state of the code allows for building the WiFi server code either with version 2.2.x of the Espressif SDK or with version 3.0.2. If the 2.2.x build is used then this is very close to the current Arduino ESP8266 Core V2.6.3 environment.

If anyone would like to take a look at the changes I've made the two repos are:
1. My fork of the Arduino ESP8266 Core [github.com] you will need the DuetWiFiESP8266 branch which is here [github.com]
2. My fork of the Duet WiFi server [github.com] you will need the newsdk-lpc branch which is here: [github.com]

Let me know if you have any questions or if this is of any interest.

Edited 1 time(s). Last edit at 02/10/2020 03:45PM by gloomyandy.
Re: Duet WiFi Socket Server ESP8266 firmware and SDK version
February 10, 2020 04:38PM
Thanks, that's very interesting, because porting the code to the v3 SDK was on my TODO list! I'll take a look at your changes. The old one using the v2 SDK is a nasty hack using LWIP 2 with an interface layer to make it look like LWIP 1 which is what the v2 SDK is written for.

I've been moving away from using the Arduino ESP8266 core and writing directly to the SDK API, because in this application the Arduino core adds very little value.

Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet WiFi Socket Server ESP8266 firmware and SDK version
February 10, 2020 04:54PM
If you are moving away from the Arduino code you may want to consider switching to use the RTOS version of the Espressif SDK. It seems that this is the version that they intend to concentrate on going forward. I was toying with the idea of trying that, but looking at their comments it seems that they have some major changes planned from the current ESP8266 RTOS version, so it may be worth sticking with the non RTOS version until things settle down a little. I've tried to keep the actual code changes as simple as I can to make it easier to pick up updates from the original repos, so some of the changes may be less than optimal (and may not be very pretty!).
Re: Duet WiFi Socket Server ESP8266 firmware and SDK version
February 11, 2020 11:24AM
Is it possibe add support i2c ssd1306 lcd? It's cheap and easy to connect.
Re: Duet WiFi Socket Server ESP8266 firmware and SDK version
November 23, 2021 07:21PM
It looks you’ve ported Duet WiFi Socket Server to ESP32 ? Have you also considered porting the whole RRF to ESP32 ?
Sorry, only registered users may post in this forum.

Click here to login