0

Building CircuitPython for ESP8266
Moderators: adafruit_support_bill, adafruit

Forum rules
Adafruit MicroPython is currently EXPERIMENTAL and BETA - Please visit https://learn.adafruit.com/category/micropython and http://forum.micropython.org/ in addition to our section here!
Please be positive and constructive with your questions and comments.

Building CircuitPython for ESP8266

by jerryn on Mon Feb 27, 2017 1:59 pm

I have not had any problem downloading the Circuit Python repository and building it for the M0 boards. I am using the Vagrant installation on a Mac and it works fine.
I would also like to build the ESP8266 version, but I am a bit confused and running into some problems.

I have ben building the ESP8266 MicroPython distribution under vagrant as decribed in:
https://learn.adafruit.com/building-and-running-micropython-on-the-esp8266/overview

but I set this up before Circuit Python was released. Does the Vagrant provisioning in this link now support CircuitPython or is it still MicroPython? Before just reinstalling I thought I'd ask.

Can you easily describe or point me to the description of how to set up the ESP8266 environment for Circuit Python.
Sorry if I am just missing something obvious.

jerryn
 
Posts: 438
Joined: Sat Sep 14, 2013 9:05 am

Re: Building CircuitPython for ESP8266

by tannewt2 on Mon Feb 27, 2017 3:02 pm

I believe that VM should work just fine. All you'll need to do is clone the CircuitPython source into it. Theres nothing different in the build instructions between MicroPython and CircuitPython that I know of.

My personal setup just has the ESP open SDK on my Mac rather than in a VM. The trickiest part is that it needs a case sensitive file system and Mac isn't by default. The instructions I followed are here: https://github.com/pfalcon/esp-open-sdk#macos

Keep me posted on how it goes!

tannewt2
 
Posts: 411
Joined: Thu Oct 06, 2016 8:48 pm

Re: Building CircuitPython for ESP8266

by jerryn on Mon Feb 27, 2017 3:08 pm

Thanks for the quick reply - the VM uses the same SDK so it "should" work. I was confused since all the CircuitPyhton specifically stuff deals only with the M0 builds and it looks like the ESP8266 tutorial still refers only to Micropython. Life on the bleeding edge is tough ;-)

I'll try to build it this evening and report back.

jerryn
 
Posts: 438
Joined: Sat Sep 14, 2013 9:05 am

Re: Building CircuitPython for ESP8266

by tannewt2 on Mon Feb 27, 2017 4:20 pm

Yeah, on the whole CircuitPython and MicroPython are the same on the ESP8266. The build system is the same for sure. Its the additional hardware API and slightly different run process that are the few differences.

Good luck!

tannewt2
 
Posts: 411
Joined: Thu Oct 06, 2016 8:48 pm

Re: Building CircuitPython for ESP8266

by jerryn on Mon Feb 27, 2017 6:50 pm

mixed results:
I can build the image just fine for both circuit python and micropython but when I upload them:
I connect via terminal session:
micropython works as it has in the past.
circuitpython attempts to boot, but after a string of invalid baud rate stuff it prints:
Code: Select all | TOGGLE FULL SIZE
ets_task(40100164, 3, 3fff839c, 4)
boot_ output:


then it hangs and I cannot get it to accept any input from the terminal.
At this point in the micropython version I enter Contro-D and I get my python prompt.

Byt the way, I get the same result using the prebuilt binary for 0.9.0 so I think it is building OK.
I am executing it on an esp8266 Huzzah breakout board.

any suggestions about how to proceed?

jerryn
 
Posts: 438
Joined: Sat Sep 14, 2013 9:05 am

Re: Building CircuitPython for ESP8266

by tannewt2 on Mon Feb 27, 2017 7:17 pm

Sounds like a bug on my end. How are you connecting to the terminal? I usually connect via screen from Mac OSX with an explicit baud rate.

tannewt2
 
Posts: 411
Joined: Thu Oct 06, 2016 8:48 pm

Re: Building CircuitPython for ESP8266

by jerryn on Mon Feb 27, 2017 7:52 pm

yes: screen /dev/ttyUSB0 115200?

It connect just fine

BTW, I am connecting from a different machine than I do the compilation on. (raspberry pi)

I did notice a difference in the way the _boot.py module is configured for circuit python vs micropython.
The micropython explicitly looks for /flash while circutpython does not.
Is this relevant.
edited - nah - I tried using the _boot.py from micropython - it built ok but similar resi=ults - this time it complained about some of the syntax in my boot.py file - so I guess it found it! Still no python prompt.

I't's getting late in Spain ... ;-)

jerryn
 
Posts: 438
Joined: Sat Sep 14, 2013 9:05 am

Re: Building CircuitPython for ESP8266

by tannewt2 on Tue Feb 28, 2017 7:27 am

What distro are you running on your Raspberry Pi? I'm testing on a Feather HUZZAH and 0.9.0 works just fine.

Have you tried typing characters into the session? I added a state that waits for input as a proxy for when the connection happens. Heres what mine looks like.

Code: Select all | TOGGLE FULL SIZE

Press any key to enter the REPL. Use CTRL-D to soft reset.


Adafruit CircuitPython 0.9.0 on 2017-02-22; ESP module with ESP8266
>>>

tannewt2
 
Posts: 411
Joined: Thu Oct 06, 2016 8:48 pm

Re: Building CircuitPython for ESP8266

by jerryn on Tue Feb 28, 2017 8:34 am

hmm - I'll give it another try when I get home this evening.
I am running a fully updated version of Jessie on my pi. It works fine with all the other version of micro/circuitpython.
I am definitely connecting but it just does not seem to accept the keystrokes and I don't see the prompt you show.
I'll try it via my Mac as well.

jerryn
 
Posts: 438
Joined: Sat Sep 14, 2013 9:05 am

Re: Building CircuitPython for ESP8266

by tannewt2 on Tue Feb 28, 2017 8:37 am

Ok, keep me posted. I don't have a Pi with me so it'll be kinda hard to test.

tannewt2
 
Posts: 411
Joined: Thu Oct 06, 2016 8:48 pm

Re: Building CircuitPython for ESP8266

by jerryn on Tue Feb 28, 2017 4:32 pm

This is what I get after loading 0.9.0 and pressing RESET on the esp8266 HUZZAH
It will not respond to any keyboard input - control-D has no effect.

I get the same thin on my Mac (this screenshot) or on my raspberry pi.
micropython 1.8.7 works as expected.

circuitpython.tiff
circuitpython.tiff (62.35 KiB) Viewed 271 times

jerryn
 
Posts: 438
Joined: Sat Sep 14, 2013 9:05 am

Re: Building CircuitPython for ESP8266

by jerryn on Tue Feb 28, 2017 4:42 pm

Well--- I tried loading 0.9.0 into a ESP8266 FEATHER HUZZAH and it all works as expected!

Any idea why the HUZZAH breakout would respond differently?

The breakout uses a UART, not USB - is that the likely issue?

BTW- I was also able to build/load 0.9.1 for the FEATHER.

jerryn
 
Posts: 438
Joined: Sat Sep 14, 2013 9:05 am

Re: Building CircuitPython for ESP8266

by tannewt2 on Wed Mar 01, 2017 6:25 am

Ah interesting! The garbage symbols could just be electrical noise. The pin initialization process might be different between MicroPython and CircuitPython which leads to the TX and RX pins floating for a bit after initialization. It doesn't work after that though right?

I don't actually have a breakout so I can't repro it here. Could probably get one though.

tannewt2
 
Posts: 411
Joined: Thu Oct 06, 2016 8:48 pm

Re: Building CircuitPython for ESP8266

by jerryn on Wed Mar 01, 2017 7:06 am

Just to clarify, I see the "garbage" with both CircuitPython and MicroPython. Circuit Python looks the same on both the breakout and the feather initially, it's just that on the breakout, Circuitpython does not respond to any keyboard input.

I noted that there are some changes to the uart.c and machine_uart.c code between circuit and micropython...

It's not clear to me how or if the breakout and the feather differ how they execute this code.

jerryn
 
Posts: 438
Joined: Sat Sep 14, 2013 9:05 am

Re: Building CircuitPython for ESP8266

by tannewt2 on Wed Mar 01, 2017 7:21 am

Ah ok!

There are a couple things I can think to check:

My general approach to debugging on the esp8266 is just to printf.

tannewt2
 
Posts: 411
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.