MicroPython on ESP32 with SPIRAM support
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: MicroPython on ESP32 with SPIRAM support
Ok that helped and but now it says
Your display is too small to run Menconfig!
It must be at least
19 lines by 80 colums
I can't find where in virtual box to give me bigger display
Edit after lots of googling I have found way to make fullscreen virtual box and now BUILD menuconfig works perfectly
Much thanks for your patience with my many questions
Your display is too small to run Menconfig!
It must be at least
19 lines by 80 colums
I can't find where in virtual box to give me bigger display
Edit after lots of googling I have found way to make fullscreen virtual box and now BUILD menuconfig works perfectly
Much thanks for your patience with my many questions
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: MicroPython on ESP32 with SPIRAM support
Ok I ran ./BUILD.sh menuconfig and created the config file.
I then ran ./BUILD.sh but got the error message
'make all' FAILED!
I then ran ./BUILD.sh but got the error message
'make all' FAILED!
Re: MicroPython on ESP32 with SPIRAM support
Hello Boris,
Sorry to pester you on Christmas eve, but its a good free time to play with micropython.
I have started playing with various micropython mqtt options on the esp32.
I'm having difficulty in understanding your version of API call for establishing a connection with a local wifi network mosquitto server broker.
At the moment everything's non secure, without passwords for simplicity.
Broker is a local SBA running mosquitto on OpenWrt linux on the same local unsecured wifi network, it works ok with standard micropython simple.py mqtt client example where only client id string and host/broker IP address are only 2 arguments required to connect.
If you have a bit of time please explain the API connection arguments in your mqtt example and provide a simple connection example to broker on local unsecured wifi network.
Sorry to pester you on Christmas eve, but its a good free time to play with micropython.
I have started playing with various micropython mqtt options on the esp32.
I'm having difficulty in understanding your version of API call for establishing a connection with a local wifi network mosquitto server broker.
At the moment everything's non secure, without passwords for simplicity.
Broker is a local SBA running mosquitto on OpenWrt linux on the same local unsecured wifi network, it works ok with standard micropython simple.py mqtt client example where only client id string and host/broker IP address are only 2 arguments required to connect.
If you have a bit of time please explain the API connection arguments in your mqtt example and provide a simple connection example to broker on local unsecured wifi network.
Thanksmqtt = network.mqtt("loboris", "loboris.eu", user="wifimcu", password="wifimculobo", cleansession=True, connected_cb=conncb, disconnected_cb=disconncb, subscribed_cb=subscb, published_cb=pubcb, data_cb=datacb)
Re: MicroPython on ESP32 with SPIRAM support
You can use mqtt_example.py for connection to broker on local network, just change "loboris.eu" to broker's IP address.
The complete documentation for all modules, including mqtt wil be pushed with the "New Year" update next week.
mqtt runs in separate thread (FreeRTOS task).
Note: When using secure connection more memory is required. If not using psRAM, you may need to lower the MicroPython heap.
Here is the simplified description of available mqtt methods:
Code: Select all
mqtt = network.mqtt(name, server [, user, password, port, autoreconnect, clientid, cleansession, keepalive, qos, retain, secure, connected_cb, disconnected_cb, subscribed_cb, unsubscribed_cb, published_cb, data_cb])
Only two first arguments are mandatory:
- name - string, mqtt identifier, used to identify the mqtt client object, for example in collback functions
- server - string, mqtt server (broker) ip address or domain name
- user - string, user name if requred by mqtt server, default: ""
- password - string, user password if requred by mqtt server, default: ""
- clientid - string, mqtt client id, it is recomended to enter some unique ID, default: "mpy_mqtt_client"
- secure - bool, if True, use secure connection, default: False
- port - int, server's mqtt port, default: 1883 if secure=False, 8883 if secure=True
- autoreconnect - bool, if True, reconnect to server if disconnected for some reason, default: False
- cleansession - bool, if True, do not use mqtt persistent session feature, default: False
- keepalive - int, Keep Alive interval in seconds, default: 120
- qos - int, mqtt QoS level, default: 0
- retain - bool, mqtt retain flag, default 0
- connected_cb - callback function executed when mqtt is connected to the server; arguments: mqtt_name
- disconnected_cb - callback function executed when mqtt is disconnected to the server; arguments: mqtt_name
- subscribed_cb - callback function executed on succesful topic subscription; arguments: (mqtt_name, topic)
- unsubscribed_cb - callback function executed when the topic is unsubscribed; arguments: (mqtt_name, topic)
- published_cb - callback function executed when the topic is published; arguments: (mqtt_name, publish_result)
- data_cb - callback function executed when new subscribed topic data arrives; arguments: (mqtt_name, topic_data_length, topic_data)
Code: Select all
mqtt.config([clientid, autoreconnect, cleansession, keepalive, qos, retain, secure, connected_cb, disconnected_cb, subscribed_cb, unsubscribed_cb, published_cb, data_cb])
All arguments are optional, if entered they must be entered as kw arguments (arg=value):
Code: Select all
mqtt.status()
The status is returned as tuple: (num_stat, description).
Possible values are:
(0, "Connected")
(1, "Disconnected")
(2, "Stopping")
(3, "Stopped")
Before issuing any other mqtt command always check the mqtt status.
Code: Select all
mqtt.subscribe(topic)
Argument topic is string, topic name.
Returns True is successfully subscribed, False if not.
Code: Select all
mqtt.unsubscribe(topic)
Argument topic is string, topic name.
Returns True is successfully subscribed, False if not.
Code: Select all
mqtt.publish(topic, msg)
Argument topic is string, topic name; msg is string, topic message
Returns True is successfully published, False if not.
Code: Select all
mqtt.stop()
Returns True on success, False on error.
Code: Select all
mqtt.start()
Code: Select all
mqtt.free()
Returns True on success, False on error.
Re: MicroPython on ESP32 with SPIRAM support
Thanks Borislav for detailed explanation.
I have it working with clarified mandatory name and server arguments.
Will continue experimenting with other options.
Best Regards
I have it working with clarified mandatory name and server arguments.
Will continue experimenting with other options.
Best Regards
Re: MicroPython on ESP32 with SPIRAM support
Hi,
so right now I cant get uasyncio working with your firmware... I'll look into it in detail when I have time, but maybe you've already come across this:
>>> loop.run_forever()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "uasyncio/core.py", line 138, in run_forever
File "uasyncio/core.py", line 107, in run_forever
AttributeError: 'generator' object has no attribute 'pend_throw'
Happens when there is a yield asyncio.IORead(mysocket) in the code...
Edit: Ah, I see, pend_throw() is a Micropython addition to generators...
Edit 2: Patching https://github.com/micropython/micropyt ... 73f4bc42be works...
mysocket.setblocking(False)
packet, address = mysocket.recvfrom(256)
throws
OSError: [Errno 110] ETIMEDOUT
however...
so right now I cant get uasyncio working with your firmware... I'll look into it in detail when I have time, but maybe you've already come across this:
>>> loop.run_forever()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "uasyncio/core.py", line 138, in run_forever
File "uasyncio/core.py", line 107, in run_forever
AttributeError: 'generator' object has no attribute 'pend_throw'
Happens when there is a yield asyncio.IORead(mysocket) in the code...
Edit: Ah, I see, pend_throw() is a Micropython addition to generators...
Edit 2: Patching https://github.com/micropython/micropyt ... 73f4bc42be works...
mysocket.setblocking(False)
packet, address = mysocket.recvfrom(256)
throws
OSError: [Errno 110] ETIMEDOUT
however...
Re: MicroPython on ESP32 with SPIRAM support
@carsten
Have you tried to use threads instead of uasyncio ?
I would be interested if you can give me some example application where uasyncio is better suited then threads.
Have you tried to use threads instead of uasyncio ?
I would be interested if you can give me some example application where uasyncio is better suited then threads.
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: MicroPython on ESP32 with SPIRAM support
When I run ./BUILD.SH I get the error
'make all' FAILED!
What am I doing wrong??
Merry Christmas to everyone
'make all' FAILED!
What am I doing wrong??
Merry Christmas to everyone
Re: MicroPython on ESP32 with SPIRAM support
@OutoftheBOTS_
Run:
That way the error messages will be visible, if any, please post them.
Run:
Code: Select all
./BUILD.sh all verbose
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: MicroPython on ESP32 with SPIRAM support
Ok Virtual box won't let me cut from inside the VM and paste outside so I have to type then out
this seems to were it started to go wrong
/home/bot/MicroPython_ESP32_psRAM_LoBo/Tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc: Syntax error: ";" unexpected
make: *** [/home/bot/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/phy_init_data.o] Error 2
Also I am using 32 bit Ubuntu as Virtual box won't run in 64 bit mode for me
this seems to were it started to go wrong
/home/bot/MicroPython_ESP32_psRAM_LoBo/Tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc: Syntax error: ";" unexpected
make: *** [/home/bot/MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/phy_init_data.o] Error 2
Also I am using 32 bit Ubuntu as Virtual box won't run in 64 bit mode for me