access point setup on boot

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
kermit
Posts: 3
Joined: Thu Aug 10, 2017 7:42 pm

access point setup on boot

Postby kermit » Fri Aug 11, 2017 2:48 pm

Hello,
I am new here so in the beginning i want to thank you guys for awesome work that you`ve done. Currently i work on project that requires esp module to setup as access point as esp8266 did, but as i can see esp32(i use esp-wroom-32 to be precise) doesn`t do that i suspect that is because webrepl is not implemented yet, but is there way to enable wifi in access point mode in current stage ?
Greetings ;)

update:
i think that is the case, when i try to import network module from repl i get error like this:

>>> import network
E (64192) wifi: invalid magic number 3ffcf140, call WIFI_INIT_CONFIG_DEFAULT to init config
E (64192) wifi: wifi_init 1361 ret=258
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: Wifi Invalid Argument


so maybe that is why the access point is not starting ?

kermit
Posts: 3
Joined: Thu Aug 10, 2017 7:42 pm

Re: access point setup on boot

Postby kermit » Sat Aug 12, 2017 8:28 am

Next edit. As i done further research i discovered that when i flash with today`s daily build: http://micropython.org/resources/firmwa ... c00f0d.bin network module works fine, but this didn`t solve my problem as i want to add some modules as frozen bytecode so i need to built it by myself, so question is how to deal with this error or where i can get code from which today`s built was done. I built my binary from latest git repo: https://github.com/micropython/micropython-esp32 , maybe checkout to older version will help but i don`t know to which commit i should checkout.

cokegen
Posts: 1
Joined: Wed Aug 16, 2017 7:58 pm

Re: access point setup on boot

Postby cokegen » Thu Aug 17, 2017 1:12 pm

Just bought a couple esp-wroom-32 modules the other day and started playing with them since the idea was to start learning Python (the hard way probably ?) and stumbled with the same problem as you.

Also tried the binary firmware the MicroPython guys currently provide at:

https://micropython.org/resources/firmw ... ad3fdb.bin

and it worked like a charm, but that leaves you without the ability to "tune" the firmware, as you correctly said in your post.

An lsb_release -a reports "Linux Mint 18 Sarah" for me, which is a base of Ubuntu Xenial to the best of my knowledge.

Did some git-fu and stole some of the versions this guy used in his video https://youtu.be/qa2406iiSbI (Adafruit Tony D)

My setup (everything goes under my home ~/esp/directories_here and following official instructions):

# xtensa-esp32-elf
- version = https://dl.espressif.com/dl/xtensa-esp3 ... 2.0.tar.gz
- just uncompress

# esp-idf
- version = tags/v2.0-rc1-22-gb8e2edc @ b8e2edc99f369eaa069e478604c47907972b2585
- ran a "git submodule update --recursive" inside the esp-idf/ directory, this is important apparently since it checks out additional esp32 code like I show below:

~/esp/esp-idf $ git submodule update --recursive
Submodule path 'components/bt/lib': checked out '9c1eea6bb03adc3b3847fff79c3f017652840a46'
Submodule path 'components/esp32/lib': checked out '45414a6778e1bf2855f18a8c6b954d5cf575bb40'
Submodule path 'components/esptool_py/esptool': checked out 'e9e9179f6fc3f2ecfc568987d3224b5e53a05f06'

# micropython-esp32
- version = tags/v1.8.7-259-g975df68 @ 975df68fac1885b4a7d27bf54dab47c74a0e2d36
- created micropython-esp32/esp32/makefile (case being important since there's also a Makefile there) with the following content (replace accordingly):

ESPIDF = /home/replaceme/esp/esp-idf
PORT = /dev/ttyUSB0
FLASH_MODE = dio
FLASH_SIZE = 4MB
#CROSS_COMPILE = xtensa-esp32-elf-

- ran "make -C mpy-cross" inside the micropython-esp32/ folder and then just a "make" inside micropython-esp32/esp32
- ran "make erase" (to erase the flash, since this is what they recommend to always do)
- ran "make deploy" (to flash the firmware)

The REPL works fine and the wifi seems to initialize now, with proof going below:

>>>
PYB: soft reboot
could not open file 'boot.py' for reading
could not open file 'main.py' for reading
MicroPython v1.8.7-259-g975df68-dirty on 2017-08-17; ESP32 module with ESP32
Type "help()" for more information.
>>> import network
>>> wlan = network.WLAN(network.STA_IF)
>>> wlan.active(True)
True
>>> wlan.scan()
I (1703272) wifi: event 1
[(b'removed', b'removed', 2, -45, 3, False)]
>>> print("cool !")
cool !
>>>

There it goes my first post ! hope to be of help and please let me know how that went for you ...

kermit
Posts: 3
Joined: Thu Aug 10, 2017 7:42 pm

Re: access point setup on boot

Postby kermit » Sat Aug 19, 2017 10:28 am

Hey, thanks Cokegen for your detailed answer, unfortunately last days i didn`t had time to check your solution, but i will do it as soon as possible and post result here. As i needed fast solution for this problem, i dealed with it by flashing my board with daily build and simply uploading needed scripts, fortunately there was enough memory to do this, but probably for production i should go with frozen bytecode so i will try your solution. Meanwhile you can check github, NyxMC posted same issue and found solution for it, but i didn`t check it yet : https://github.com/micropython/micropyt ... issues/163


Who is online

Users browsing this forum: No registered users and 3 guests