Early access releases #3 & #4

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Early access releases #3 & #4

Post by pfalcon » Fri Apr 08, 2016 11:03 am

This topic is to discuss early access releases #3 & #4, as delivered to backers who selected corresponding reward types during the Kickstarter campaign.

To keep it a bit more organized, we created a new topic and closed the older one: http://forum.micropython.org/viewtopic.php?f=16&t=1595
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

wendlers
Posts: 47
Joined: Wed Mar 16, 2016 10:07 pm

Re: Early access release #3

Post by wendlers » Fri Apr 08, 2016 6:32 pm

Hi,

just flashed v03 to my LoLin NodeMCU and gave WebREPL a first try. Works very well so far (also disconnect/reconnect seams not to be implemented yet).

Thanks for the great work so far,
Stefan

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Early access release #3

Post by pfalcon » Fri Apr 08, 2016 7:00 pm

As with initial FS support in early #1, WebREPL so far is in "manual" mode for full user control/visibility/reportability. "webrepl2" module serves just one webrepl session so far. It starts serving automatically on import, and then serving can be restarted by calling "webrepl2.start()". If that's the kind of disconnect/reconnect you mean, please give it a try.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

wendlers
Posts: 47
Joined: Wed Mar 16, 2016 10:07 pm

Re: Early access release #3

Post by wendlers » Sun Apr 10, 2016 6:40 pm

pfalcon wrote:As with initial FS support in early #1, WebREPL so far is in "manual" mode for full user control/visibility/reportability. "webrepl2" module serves just one webrepl session so far. It starts serving automatically on import, and then serving can be restarted by calling "webrepl2.start()". If that's the kind of disconnect/reconnect you mean, please give it a try.
Yes, "webrepl2.start()" does the trick, thanks.

wendlers
Posts: 47
Joined: Wed Mar 16, 2016 10:07 pm

Re: Early access release #3

Post by wendlers » Sun Apr 10, 2016 7:34 pm

Hi,

when using the flash FS to store some python modules, I get memory allocation errors. The setup roughly is as folows:

I put three modules on the flash FS (using this little helper script I wrote a while ago: https://github.com/wendlers/mpfshell):

A.py : imports some internal modules, some python code (about 270 lines / 2.9k)
B.py : jsut some python code (about 130 lines / 3.2k)
C.py : imports A and B, also some python code (about 75 lines / 1.5k)

Now when I import C on the REPL, I get the following error:

Code: Select all

readblocks(8, 3ffef850(4096))
readblocks(2, 3ffef810(4096))
readblocks(6, 3ffefa50(4096))
readblocks(2, 3ffef7f0(4096))
readblocks(7, 3fff1390(4096))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "homematic.py", line 2, in <module>
MemoryError: memory allocation failed, allocating 257 bytes
When I remove some code in module C (about 15-20 lines), the import works.
Also, when I use the Micropython code from the repository and add the above modules as frozen modules, importing C works fine.

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Early access release #3

Post by pfalcon » Mon Apr 11, 2016 6:19 pm

wendlers, thanks for the report, yes, esp8266 has the second smallest heap size after BBC:Micro of officially supported boards, and we need to keep that in mind. It may be cool to implement filesystem largely in Python, but we need to optimize that by rewriting in C.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Early access release #3

Post by pfalcon » Mon Apr 11, 2016 6:20 pm

Come on guys, no feedback from anyone else? Early access backers are the front cohort of the project, we really need your feedback, especially taking into account that release is not so far away.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: Early access release #3

Post by platforma » Mon Apr 11, 2016 7:52 pm

Hey,

This is all done on ESP12E with a simple breakout (non NodeMCU) board connected through USD-Serial adapter, after erase_flash and new firmware flashed at 115200 with --flash_size=8m. The same process worked fine with the same hardware for all the previous alphas.

Upon flashing and starting the module without any further interactions, I have the AP called "ESP_FC600B" but it is not password protected as described, I can connect to it straight away. Trying the following doesn't change the AP password.

Code: Select all

>>> import network
>>> ap_if = network.WLAN(network.AP_IF)
>>> ap_if.config(password="micropython")
bcn 0
del if1
usl
add if1
#5 ets_task(4020e20c, 29, 3fff5c80, 10)
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
>>> 
But the main issue I'm having is the fact that on every single Ctrl-D reset, or even trying to reset the module manually with power down/up, I will no longer be able to get the REPL back and all I see is the familiar filesystem error message repeating over and over and I see occasional WiFi (e.g chg_A2: -40) measurements in between.

Code: Select all

>>> print("hello world")
hello world
>>> 
PYB: soft reboot
ioctl(1, 0)
ioctl(5, 0)
readblocks(0, 3ffef680(4096))
readblocks(0, 3ffef850(4096))
ioctl(1, 0)
ioctl(5, 0)
readblocks(0, 3ffef940(4096))
ioctl(1, 0)
ioctl(5, 0)
readblocks(0, 3ffefa50(4096))
FAT filesystem appears to be corrupted. If you had important data there, you
may want to make a flash snapshot to try to recover it. Otherwise, perform
factory reprogramming of MicroPython firmware (completely erase flash, followed
by firmware programming).
... message repeats
I am fairly certain the module has 1MB of flash and it has worked previously, but please correct me if I'm wrong :)

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: Early access release #3

Post by pfalcon » Mon Apr 11, 2016 10:00 pm

platforma, this is very suspiciously reminds the issue previously reported by @deshipu: http://forum.micropython.org/viewtopic.php?f=16&t=1700 . Can you get together with him and see if you have any commonalities in your setups? But first please post output of

Code: Select all

hex(esp.flash_id())
.

And the main point: with the bootstrap process and other related issues having been settled, we just pushed to master initial bootstrapping scripts. So, if they don't work for you, you can see how they work, add debug output, etc. (Please share further info in a separate thread, e.g. deshipu's).
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

User avatar
kfricke
Posts: 342
Joined: Mon May 05, 2014 9:13 am
Location: Germany

Re: Early access release #3

Post by kfricke » Mon Apr 11, 2016 10:47 pm

My Huzzah feather works like a charm so far. Just flashed the v3 alpha and took some time to poke around...

The block device now shows up a little more descriptive (using dir(bdev)), or I did learn some more details by implementing my own file based block device in the Unix port as a practice.

The previous content of my flash filesystem did show up as previously seen and the simple test module is able to import as usual.

The introduction to the WebREPL did also work flawlessly for the initial walk around.

One difference i can see is what is being printed onto the serial REPL and the WebREPL. Please check esp.meminfo at the end of the session. The command got repeated from the WebREPL and the UART REPL, always showing the whole truth only on the UART REPL.

Let me provide you with the whole transcript for completeness:

WebREPL:

Code: Select all

Welcome to MicroPython!
Connected
>>> dir()                                                                       
['webrepl2', '__name__', 'builtins', 'uos', 'bdev', 'vfs']                      
>>> dir(builtsins)                                                              
Traceback (most recent call last):                                              
  File "<stdin>", line 1, in <module>                                           
NameError: name 'builtsins' is not defined                                      
>>> dir(builtins)                                                               
['__build_class__', '__import__', '__repl_print__', 'bool', 'bytes', 'bytearray'
, 'dict', 'enumerate', 'filter', 'float', 'frozenset', 'int', 'list', 'map', 'me
moryview', 'object', 'property', 'range', 'reversed', 'set', 'str', 'super', 'tu
ple', 'type', 'zip', 'classmethod', 'staticmethod', 'Ellipsis', 'abs', 'all', 'a
ny', 'bin', 'callable', 'chr', 'dir', 'divmod', 'eval', 'exec', 'getattr', 'seta
ttr', 'globals', 'hasattr', 'hash', 'hex', 'id', 'isinstance', 'issubclass', 'it
er', 'len', 'locals', 'max', 'min', 'next', 'oct', 'ord', 'pow', 'print', 'repr'
, 'round', 'sorted', 'sum', 'BaseException', 'ArithmeticError', 'AssertionError'
, 'AttributeError', 'EOFError', 'Exception', 'GeneratorExit', 'ImportError', 'In
dentationError', 'IndexError', 'KeyboardInterrupt', 'KeyError', 'LookupError', '
MemoryError', 'NameError', 'NotImplementedError', 'OSError', 'OverflowError', 'R
untimeError', 'StopIteration', 'SyntaxError', 'SystemExit', 'TypeError', 'Unicod
eError', 'ValueError', 'ZeroDivisionError', 'open']                             
>>> vfs.listdir()     
['desd.py']                                                                     
>>> d = open('desd.py', 'r')                                                    
>>> d.readlines()                                                               
readblocks(7, 3fff29d0(4096))                                                   
['print(2*2)']                                                                  
>>> import desd                                                                 
readblocks(2, 3fff3210(4096))                                                   
readblocks(7, 3fff3560(4096))                                                   
4                                                                               
>>> import esp                                                                  
>>> dir(esp)
['__name__', 'osdebug', 'sleep_type', 'deepsleep', 'flash_id', 'flash_read', 'fl
ash_write', 'flash_erase', 'neopixel_write', 'freemem', 'meminfo', 'SLEEP_NONE',
 'SLEEP_LIGHT', 'SLEEP_MODEM', 'STA_MODE', 'AP_MODE', 'STA_AP_MODE']            
>>> import machine                                                              
>>> dir(machine)                                                                
['__name__', 'mem8', 'mem16', 'mem32', 'freq', 'reset', 'unique_id', 'Timer', 'P
in', 'PWM', 'ADC', 'UART', 'I2C', 'SPI']                                        
>>> esp.meminfo()                                                               
sp: 0x3ffff850                                                                  
>>> esp.meminfo()                                                               
sp: 0x3ffff850                                                                  
>>> esp.meminfo()                                                               
sp: 0x3ffff850                                                                  
>>>                                                        
One the UART REPL i did the following:

Code: Select all

>>> dir()
['__name__', 'builtins', 'uos', 'bdev', 'vfs']
>>> dir(bdev)
['__init__', '__module__', 'ioctl', 'SEC_SIZE', '__qualname__', 'NUM_BLK', 'read                                    blocks', 'START_SEC', 'writeblocks', 'blocks']
>>> bdev.blocks
64
>>> bdev.SEC_SIZE
4096
>>> bdev.START_SEC
160
>>> bdev.NUM_BLK
64
>>> vfs.listdir()
['desd.py']
>>> dir(vfs)
['mkfs', 'open', 'listdir', 'mkdir', 'remove', 'rename']
>>> import webrepl2
Bind address info: [(2, 1, 0, '', ('0.0.0.0', 8080))]
<socket state=2 timeout=-1 incoming=3fff62f8 remaining=0>
b'GET / HTTP/1.1\r\n'(b'Host', b'192.168.188.57:8080')
(b'Connection', b'Upgrade')
(b'Pragma', b'no-cache')
(b'Cache-Control', b'no-cache')
(b'Upgrade', b'websocket')
(b'Origin', b'file://')
(b'Sec-WebSocket-Version', b'13')
(b'User-Agent', b'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36')
(b'Accept-Encoding', b'gzip, deflate, sdch')
(b'Accept-Language', b'de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4')
(b'Sec-WebSocket-Key', b'5Vxe1X0RNBwP+yGG3+qlzw==')
(b'Sec-WebSocket-Extensions', b'permessage-deflate; client_max_window_bits')
b'5Vxe1X0RNBwP+yGG3+qlzw==' 24
b'6}\x07\x1bQ\xc7\xe4z\x98\xff\xe0\xa2\xd2\xce\x87\xaf\xa1\x8c\xf04'
b'Nn0HG1HH5HqY/+Ci0s6Hr6GM8DQ='
b'HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: Nn0HG1HH5HqY/+Ci0s6Hr6GM8DQ=\r\n\r\n'
Connected
>>> dir()
['webrepl2', '__name__', 'builtins', 'uos', 'bdev', 'vfs']
>>> dir(builtsins)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'builtsins' is not defined
>>> dir(builtins)
['__build_class__', '__import__', '__repl_print__', 'bool', 'bytes', 'bytearray', 'dict', 'enumerate', 'filter', 'float', 'frozenset', 'int', 'list', 'map', 'memoryview', 'object', 'property', 'range', 'reversed', 'set', 'str', 'super', 'tuple', 'type', 'zip', 'classmethod', 'staticmethod', 'Ellipsis', 'abs', 'all', 'any', 'bin', 'callable', 'chr', 'dir', 'divmod', 'eval', 'exec', 'getattr', 'setattr', 'globals', 'hasattr', 'hash', 'hex', 'id', 'isinstance', 'issubclass', 'iter', 'len', 'locals', 'max', 'min', 'next', 'oct', 'ord', 'pow', 'print', 'repr', 'round', 'sorted', 'sum', 'BaseException', 'ArithmeticError', 'AssertionError', 'AttributeError', 'EOFError', 'Exception', 'GeneratorExit', 'ImportError', 'IndentationError', 'IndexError', 'KeyboardInterrupt', 'KeyError', 'LookupError', 'MemoryError', 'NameError', 'NotImplementedError', 'OSError', 'OverflowError', 'RuntimeError', 'StopIteration', 'SyntaxError', 'SystemExit', 'TypeError', 'UnicodeError', 'ValueError', 'ZeroDivisionError', 'open']
>>> vfs.listdir()
['desd.py']
>>> d = open('desd.py', 'r')
>>> d.readlines()
readblocks(7, 3fff29d0(4096))
['print(2*2)']
>>> import desd
readblocks(2, 3fff3210(4096))
readblocks(7, 3fff3560(4096))
4
>>> import esp
>>> dir(esp)
['__name__', 'osdebug', 'sleep_type', 'deepsleep', 'flash_id', 'flash_read', 'flash_write', 'flash_erase', 'neopixel_write', 'freemem', 'meminfo', 'SLEEP_NONE', 'SLEEP_LIGHT', 'SLEEP_MODEM', 'STA_MODE', 'AP_MODE', 'STA_AP_MODE']
>>> import machine
>>> dir(machine)
['__name__', 'mem8', 'mem16', 'mem32', 'freq', 'reset', 'unique_id', 'Timer', 'Pin', 'PWM', 'ADC', 'UART', 'I2C', 'SPI']
>>> esp.meminfo()
data  : 0x3ffe8000 ~ 0x3ffe83e8, len: 1000
rodata: 0x3ffe83f0 ~ 0x3ffe8e4c, len: 2652
bss   : 0x3ffe8e50 ~ 0x3fff5780, len: 51504
heap  : 0x3fff5780 ~ 0x3fffc000, len: 26752
sp: 0x3ffff850
>>> esp.meminfo()
data  : 0x3ffe8000 ~ 0x3ffe83e8, len: 1000
rodata: 0x3ffe83f0 ~ 0x3ffe8e4c, len: 2652
bss   : 0x3ffe8e50 ~ 0x3fff5780, len: 51504
heap  : 0x3fff5780 ~ 0x3fffc000, len: 26752
sp: 0x3ffff850
>>> esp.meminfo()
data  : 0x3ffe8000 ~ 0x3ffe83e8, len: 1000
rodata: 0x3ffe83f0 ~ 0x3ffe8e4c, len: 2652
bss   : 0x3ffe8e50 ~ 0x3fff5780, len: 51504
heap  : 0x3fff5780 ~ 0x3fffc000, len: 26752
sp: 0x3ffff850
>>>
Sadly i do have little spare time besides my day job these days, so more tests must be delayed until next weekend...

Locked