Differences between Micropython ports for ESP32 and ESP8266

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
torwag
Posts: 206
Joined: Fri Dec 13, 2013 9:25 am

Differences between Micropython ports for ESP32 and ESP8266

Post by torwag » Thu Aug 17, 2017 7:43 pm

Hi,
as many questions move around with the meta topic, "Can I do / I can't do something on the ESP32, I used to do on the ESP8266", I thought it would be a good idea to collect user experiences and observations. This info can go back then as feature requests, bug reports or into an official part of the documentation.
This thread is just for collecting, updating and discussing. If particular infos are confirmed github and docs can be triggered. Sure you can and should open individual threads if needed. If so simply post here and link to it. I will try to keep the list up-to-date for easy finding and screening.

User avatar
honestcomrade
Posts: 3
Joined: Wed Jul 19, 2017 4:28 am

Re: Differences between Micropython ports for ESP32 and ESP8266

Post by honestcomrade » Tue Aug 22, 2017 4:20 am

I recently made my first forays into MicroPython (and the python world in general) on an ESP32 board (Adafruit Feather). I followed Tony D's (from adafruit) guide and was running the REPL in a few hours without too many issues. I have built a few projects using an ESP8266 board but not in MicroPython so I don't have too much to offer in terms of "differences" between what's currently limited/broken on the ESP32 fork of the MicroPython library. That being said one of the issues I had with the ESP32 on MicroPython was running any of the (compiled? frozen?) .mpy modules that I found. I was always given a similar error about not having the right version of python installed from the REPL prompt. So i've only used .py library files since then. I didn't see anyone else run into this issue on the web so it might be me or might have been fixed. I have push a fresh set of firmware to the board nor have I looked much at the library since about a month ago when I was first having the issue.

Another small, strange issue I ran into was with another adafruit peripheral in MicroPython on the ESP32: their SSD1306 oled board. In order to get the REPL to recognize the display over I2C and not just shoot random pixels, after lots of troubleshooting I ended up changing the SSD1306 library file provided by Tony D. I changed the __init__ function of the screen's I2C class by shifting the address passed to it up by one hex address (addr=0x3d) and all of a sudden it worked on next boot.
I should probably file an issue on his repo but I wasn't sure if it was some other bug and haven't messed with it in a while.

Anyway I don't have too much experience to drawn on as stated, but that's what I've noticed so far. I'd love to hear other's undertakings!
Last edited by honestcomrade on Tue Aug 22, 2017 4:52 pm, edited 1 time in total.

User avatar
pythoncoder
Posts: 3245
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Differences between Micropython ports for ESP32 and ESP8266

Post by pythoncoder » Tue Aug 22, 2017 12:00 pm

The big difference is that the ESP8266 "remembers" WiFi credentials and reconnects automatically. The ESP32 can do this while power is up, but credentials are not stored in Flash so do not survive a power cycle.

I haven't yet tried to build the source so have no comments on that process.

I encountered and raised a couple of issues when trying to port my asynchronous MQTT driver to the ESP32. Its behaviour when reconnecting to a WiFi network is odd, and nonblocking sockets seem flaky. My port has major limitations until these underlying firmware issues are fixed.

But the ESP32 port is new and these things are to be expected. When the ESP8266 port was similarly young it had numerous issues.
Peter Hinch

Online
User avatar
mattyt
Posts: 191
Joined: Mon Jan 23, 2017 6:39 am

Re: Differences between Micropython ports for ESP32 and ESP8266

Post by mattyt » Wed Aug 23, 2017 5:07 am

There are some subtle differences in the NeoPixel implemetation between ESP32 and ESP8266 ports. This is captured in ESP32 #159.

Currently the default timing of the WS2812B protocol is different (and, IMO, incorrect on the ESP32) between the two micros. By default the ESP32 uses the slower '400KHz' timing which, as best as I can tell, is out-of-spec with the majority of WS2812B LEDs (certainly with the models I own!). They can be made equivalent if "timing=True" is passed to the ESP32 NeoPixel when initialised; this configures the implementation to use the more common '800KHz' timing.

I was planning on making the implementations equivalent out-of-the-box (ie change the defaults for the ESP32) but Loboris, in another thread, mentioned that they've introduced a large number of improvements to NeoPixel in their fork of the ESP32 port. It seems more likely that we'll merge these changes back to the main ESP32 port rather than update the current implementation.

That would make the differences between the ports more significant. :o

Unfortunately Loboris' implementation isn't easy to port to the ESP8266 as it uses features specific to the ESP32 (particularly the RMT module). We may be able to port some of the new features but I'm not committing to that just yet...a more likely scenario is to make the ESP32 NeoPixel a superset of the ESP8266 NeoPixel.

Hopefully that's the kind of topic you were looking for Torwag? :)

User avatar
VisualEcho
Posts: 17
Joined: Mon Jul 04, 2016 7:49 pm
Location: Ann Arbor, Michigan
Contact:

Re: Differences between Micropython ports for ESP32 and ESP8266

Post by VisualEcho » Sun Sep 17, 2017 7:32 pm

WebREPL comes to mind. I'm making custom ESP32-WROOM gizmos to run household tasks, I'm still not sure of a way for a remote wireless ESP32 embed to update microPython files without WebREPL. Adafruit 'ampy' is saving me here, used over a serial TTL wire to the TX/Rx pins, so maybe somebody can enlighten me on a different way.

"import signal" - can't do this no mo

There seem to be functions that don't work even though they are ported, for example, 'machine.freq(80000000)' doesn't throw an error and doesn't work.

Instead of 'do something I used to', I'm hoping for more 'switched to ESP32 from ESP8266 because it does XXX, but the code isn't written yet' questions. I'm compiling the whole tool chain and code branch, and starting to want bluetooth a lot. I know nothing of the bluetooth stack, but I'm about to start throwing neurobiscuits at it.

Mesh networking. I could use a driver or library for a pile of ESP32's to chat and gossip. I know there are solutions in 'C", maybe even interface to Espressif's code, I don't know much about it.

Also...dual core. ESP32 has two, right?. Well, kinda, okay so one is vestigial. IMHO Multi-threading support would be the marmoset's mitochondria.

gepd
Posts: 12
Joined: Sat Oct 14, 2017 8:13 pm

Re: Differences between Micropython ports for ESP32 and ESP8266

Post by gepd » Sun Oct 29, 2017 9:39 pm

VisualEcho wrote:
Sun Sep 17, 2017 7:32 pm
WebREPL comes to mind. I'm making custom ESP32-WROOM gizmos to run household tasks, I'm still not sure of a way for a remote wireless ESP32 embed to update microPython files without WebREPL. Adafruit 'ampy' is saving me here, used over a serial TTL wire to the TX/Rx pins, so maybe somebody can enlighten me on a different way.
I'm developing a tool to work with micropython and Sublime Text, it uses the ampy script but it automatizes the process so you can use shorcuts when you wanto to run or put a file in your device, look more info here: https://github.com/gepd/uPiotMicroPythonTool
VisualEcho wrote:
Sun Sep 17, 2017 7:32 pm
Also...dual core. ESP32 has two, right?. Well, kinda, okay so one is vestigial. IMHO Multi-threading support would be the marmoset's mitochondria.
Seems like loboris port support multi-threading https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo
That port has more features than offical esp32 repository, it supports telnet so you could work with RELP with wifi, I'm working to add this in my plugin

I'm also checking all features availables in the official esp32 uPython vs esp8266 the idea is to have this information in the docs

lfast
Posts: 8
Joined: Mon Jul 09, 2018 6:57 pm

Re: Differences between Micropython ports for ESP32 and ESP8266

Post by lfast » Fri Sep 07, 2018 9:30 pm

Timer Module. This is all anecdotal. The 8266 seemed to let me create an arbitrary number (7 in my case) of Timer objects in the id=20+ range. On the esp32 when I hit 4 the timers started failing. I could create the objects but any attempt to use timer.start() would give me a OS Error 261. I posted it as an issue here: https://github.com/micropython/micropython/issues/4078

OutoftheBOTS_
Posts: 517
Joined: Mon Nov 20, 2017 10:18 am

Re: Differences between Micropython ports for ESP32 and ESP8266

Post by OutoftheBOTS_ » Sat Sep 08, 2018 12:01 am

Probably for me the biggest difference between ESP8266 and ESP32 is the fact I have only encountered 1 commonly used port of MP for ESP8266 where as there is many commonly used ports for ESP32 : Official, Adafruit, Laboris, MStasck and a few other less commonly used ports. To make things worse is many of these ports don't have much docs.

Real life use of MP on both platforms I have found that MP on ESP8266 is fairly marginal because of low RAM. This has make it much more difficult to develop complex projects on ESP8266. I find that ESP8266 is more practical as a basic node rather than a MCU to drive complex tasks. The current price of ESP32 boards and the availability of ESP32 with psRAM as well as the fact that ESP32 is dual core allowing for WiFi to run in real time on separate core without blocking real time processing on main MP core means the real life comparison between ESP8266 and ESP32 is chalk and cheese.

The biggest problem I find with different platforms of MP is the machine module. It really breaks the mantra of MP of having a standard syntax across all platforms. IMO I think the PYB module should be fazed out in the favor of a machine module with standard syntax across all platforms.
Last edited by OutoftheBOTS_ on Sat Sep 08, 2018 12:09 am, edited 1 time in total.

OutoftheBOTS_
Posts: 517
Joined: Mon Nov 20, 2017 10:18 am

Re: Differences between Micropython ports for ESP32 and ESP8266

Post by OutoftheBOTS_ » Sat Sep 08, 2018 12:06 am

mattyt wrote:
Wed Aug 23, 2017 5:07 am
There are some subtle differences in the NeoPixel implemetation between ESP32 and ESP8266 ports. This is captured in ESP32 #159.

Currently the default timing of the WS2812B protocol is different (and, IMO, incorrect on the ESP32) between the two micros. By default the ESP32 uses the slower '400KHz' timing which, as best as I can tell, is out-of-spec with the majority of WS2812B LEDs (certainly with the models I own!). They can be made equivalent if "timing=True" is passed to the ESP32 NeoPixel when initialised; this configures the implementation to use the more common '800KHz' timing.

I was planning on making the implementations equivalent out-of-the-box (ie change the defaults for the ESP32) but Loboris, in another thread, mentioned that they've introduced a large number of improvements to NeoPixel in their fork of the ESP32 port. It seems more likely that we'll merge these changes back to the main ESP32 port rather than update the current implementation.

That would make the differences between the ports more significant. :o

Unfortunately Loboris' implementation isn't easy to port to the ESP8266 as it uses features specific to the ESP32 (particularly the RMT module). We may be able to port some of the new features but I'm not committing to that just yet...a more likely scenario is to make the ESP32 NeoPixel a superset of the ESP8266 NeoPixel.

Hopefully that's the kind of topic you were looking for Torwag? :)
In my experience it is hard to have a standard library for NeoPixel as there is no such thing as a standard NeoPixel but rather so many clones with most of them having different timings and no matter how the seller advertised the IC on the LED it is not till u put them under the microscope and look at the IC that you can try ti identify it then set correct timings. On laboris port there is a method to set timing to suit the IC on the LED

OutoftheBOTS_
Posts: 517
Joined: Mon Nov 20, 2017 10:18 am

Re: Differences between Micropython ports for ESP32 and ESP8266

Post by OutoftheBOTS_ » Sat Sep 08, 2018 12:09 am

WebREPL comes to mind. I'm making custom ESP32-WROOM gizmos to run household tasks, I'm still not sure of a way for a remote wireless ESP32 embed to update microPython files without WebREPL
Most people have used FTP server to update files on a ESP32 wirelessly there is a number of FTP server around. It is my assumption that webrepl uses FTP to upload files.

Post Reply