MicroPython on ESP32 with SPIRAM support

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
loboris
Posts: 344
Joined: Fri Oct 02, 2015 6:19 pm

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Wed Jan 10, 2018 8:01 pm

rdagger wrote:
Wed Jan 10, 2018 7:13 pm
There's a lot of interest in Bluetooth and BLE. Any updates on the BT module?
Espressif has finally included BT classic (which I'm most interested in) into esp-idf.
I have some work on BT module done, now I'll dedicate more time to this module (classic/SPP profile & BLE). I expect some results by the end of the month.

cartere
Posts: 25
Joined: Sat Feb 04, 2017 9:26 pm

i2c problem

Post by cartere » Fri Jan 12, 2018 4:27 am

I am using a ina219's to monitor current and power into and out of a small solar charge controller. After running for an hour or two the i2c bus will glitch I get "OSError: I2C bus error (-1)" . The loss of one reading is not a big deal I would like to do a try except block and just ignore it but don't really know what that should look like, from what I have read I need the OSError number that is defined as "I2C bus error" or just trap all OSError's? Any idea where I can find an OSError list?

This is all running on a Lolin Pro with the latest version of Loboris's software.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Fri Jan 12, 2018 9:23 am

I am new to micropython but this is how I would do it in python and assume it will work for micropython.
It will run your code forever even if there is an error it will try again except if there is a keyboard interrupt then it will break out.

Code: Select all

while True:
  try:
    #run your code
  except KeyboardInterrupt: break
  else: pass
Also if you want to only catch your exact error then you can list it the same as I diud with KeyboardInterrupt. To know what the exact error is called you can look at the out put to the screen when you get the error, it will tell you what error it got.

cartere
Posts: 25
Joined: Sat Feb 04, 2017 9:26 pm

i2c problem

Post by cartere » Fri Jan 12, 2018 1:13 pm

Thanks OutoftheBOTS_, everything in deepsleep at the moment ( night ) should wake up in an hour and I will give that a try.

cartere
Posts: 25
Joined: Sat Feb 04, 2017 9:26 pm

MQTT

Post by cartere » Fri Jan 12, 2018 5:56 pm

Loboris I am trying to run two ESP32's on the same wireless network both sending sensor readings to the same broker they are not close enough to each other for this to be an RF issue. Both have different client names but when both are running I see multiple connects and disconnects. The broker is mosquito running on a raspi which is going to make using Wireshark difficult, I suspect the clients are using a default client ..........................break ...........................break

After a closer reading of the docs I found that 'name' is used internally while 'clientid' is sent to the broker, after assigning different clientid's all is working now.

loboris
Posts: 344
Joined: Fri Oct 02, 2015 6:19 pm

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Sat Jan 13, 2018 8:31 pm

:!: Update:
  • More prebuilt firmwares added. Prebuilt firmwares can now be downloaded as zip file.
  • SPI module updated, some bugs fixed.
  • esp-idf and Xtenssa toolchain updated.
  • Updated _thread module, _thread.wait() function added. Class functions can now be used in threads. Wiki updated.
  • Updated utime module. Fixed bug in utime.sleep & utime.sleep_ms
  • Updated PWM module. Up to 8 channels can now be used. Some bug fixes and improvements. Wiki added.
You can support this project by donating via PayPal

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

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Sat Jan 13, 2018 9:15 pm

@loboris Thanks again for all the hours you put into this project so the rest of us can play with it :)

I looked at the updated docs and look forward to getting some time to play with it all.

I do have 1 question that google can't seem to find the answer for me. What is the difference between using time vs utime ??

ttmetro
Posts: 104
Joined: Mon Jul 31, 2017 12:44 am

Re: MicroPython on ESP32 with SPIRAM support

Post by ttmetro » Sat Jan 13, 2018 9:23 pm

The "u" prefix indicates a possibly not complete implementation of a Python library with the same name. Usually you can omit the "u" in your imports.
Bernhard Boser

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

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Sun Jan 14, 2018 8:28 am

@ttmetro thanks! that also expalins ustrut :)

slzatz
Posts: 92
Joined: Mon Feb 09, 2015 1:09 am

rshell and sd card

Post by slzatz » Mon Jan 15, 2018 3:27 am

Am using the latest @loboris firmware and using SPI to access an sd card and after mounting the sd card reading and writing files to "/sd" works fine and os.stat("/sd") works as well but rshell does not see the "/sd" directory only the "/flash" directory. Not sure it's helpful but below are the messages after mounting the card and a few interactions with the card via micropython.

Code: Select all

MicroPython ESP32_LoBo_v3.1.3 - 2017-01-13 on ESP32 board with ESP32
Type "help()" for more information.
>>> import uos
>> uos.mountsd()
D (21049) intr_alloc: Connected src 30 to int 9 (cpu 1)
---------------------
 Mode: SPI
 Name: SS08G
 Type: SDHC/SDXC
Speed: default speed (25 MHz)
 Size: 7580 MB
  CSD: ver=1, sector_size=512, capacity=15523840 read_bl_len=9
  SCR: sd_spec=2, bus_width=5

>>> uos.listdir("/sd")
['test']
>>> uos.stat("/sd")
(16384, 0, 0, 0, 0, 0, -658292736, 946684800, 946684800, 946684800)
Are others able to use rshell to access an sd card connected via SPI to an ESP32 running @loboris firmware?

Post Reply