MicroPython on ESP32 with SPIRAM support

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
straga
Posts: 14
Joined: Mon Apr 17, 2017 7:38 am

Re: MicroPython on ESP-WROVER with 4MB of psRAM

Post by straga » Tue Aug 01, 2017 5:32 pm

Thanks for tools. FTP work create with SPIFFS.

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

Re: MicroPython on ESP-WROVER with 4MB of psRAM

Post by loboris » Wed Aug 02, 2017 8:51 am

straga wrote:... FTP work create with SPIFFS.
Sorry, I don't understand what do you mean by that...

straga
Posts: 14
Joined: Mon Apr 17, 2017 7:38 am

Re: MicroPython on ESP-WROVER with 4MB of psRAM

Post by straga » Wed Aug 02, 2017 12:35 pm

May be i am wrong. But sometime ago i am tested ftp and something not work.
Now all works.

User avatar
cwt
Posts: 2
Joined: Tue Jun 06, 2017 5:58 am
Location: Thailand
Contact:

Re: MicroPython on ESP-WROVER with 4MB of psRAM

Post by cwt » Thu Aug 03, 2017 3:18 am

I just compile with bluetooth support (selected in menuconfig), but how I can use bluetooth in python?

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

Re: MicroPython on ESP-WROVER with 4MB of psRAM

Post by loboris » Thu Aug 03, 2017 7:39 am

cwt wrote:I just compile with bluetooth support (selected in menuconfig), but how I can use bluetooth in python?
All configuration options related to MicroPython are under MicroPython menu.
→ Component config → Bluetooth → Bluedroid Bluetooth stack enabled only enables BT stack on ESP32.
MicroPython Bluetooth support will be added probably next week, I'm looking for the best way to integrate also the BT classic SPP profile (not yet supported in esp-idf) so that the REPL over BT will be possible ...

User avatar
cwt
Posts: 2
Joined: Tue Jun 06, 2017 5:58 am
Location: Thailand
Contact:

Re: MicroPython on ESP-WROVER with 4MB of psRAM

Post by cwt » Tue Aug 08, 2017 1:41 am

loboris wrote:
cwt wrote:I just compile with bluetooth support (selected in menuconfig), but how I can use bluetooth in python?
All configuration options related to MicroPython are under MicroPython menu.
→ Component config → Bluetooth → Bluedroid Bluetooth stack enabled only enables BT stack on ESP32.
MicroPython Bluetooth support will be added probably next week, I'm looking for the best way to integrate also the BT classic SPP profile (not yet supported in esp-idf) so that the REPL over BT will be possible ...
Thank you.

Another thing, I see that your repo is pretty much in parallel (if not already leaped ahead) to the micropython-esp32 https://github.com/micropython/micropython-esp32, moreover, some features such as RTC or deepsleep are already implemented in your repo. Do you plan to merge your work to micropython-esp32? It would be nice if everything are consolidated into one repo.

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

Re: MicroPython on ESP-WROVER with 4MB of psRAM

Post by loboris » Sun Aug 20, 2017 11:30 am

:!: New modules, improvements, added functionality, bug fixes and more...

During the next week, detailed documentation and examples for all added or changed modules will be pushed to the GitHub repository.

display module

support for SPI TFT displays based on ILI9341, ILI9488 & ST7789V controllers based on my TFT library
  • full set of graphics drawing methods, pixel, line, lineByAngle, triangle, circle, ellipse, rect, roundrect, arc, polygon
  • 9 embeded fonts, including vector 7-segment font and unlimited number of fonts from file
  • flexible text method, displaying text at any angle, transparent or opaque, ...
  • image support, jpg or bmp images with scalling
  • clipping window support
  • touch panel support
  • reading from display memory support
  • and more...
curl module
  • get method, http & https are supported
  • post method, http & https are supported, using multipart/form-data, unlimited number of fields/files can be sent
  • sendmail method, send mail with unlimited number of attachment files, ssl/tls supported, tested with gmail
  • ftp methods, get, put, list
  • more will be added later ...
ssh module
  • get method, download the file using scp protocol
  • put method, upload the file using scp protocol
  • list & llist methods, list files on server using sftp protocol
  • exec method, execute any command/application on server and get the rusult
Neopixel module
  • uses ESP32 RMT peripheral for precise timing
  • custom timings can be set, any RGB chip can be driven (defaults to WS2812)
  • any color order is supported
  • included methods: clear, set, setHSB, get, show, brightness, HSBtoRGB, RGBtoHSB, timings, color_order
hwI2C module
  • uses ESP32 I2C driver
_thread module
  • _thread module is greatly improved and more reliable
  • creating thread returns unique thread id used by various thread methods
  • inter-thread notification support, methods: notify, getnotification
  • inter-thread messaging, threads can exchange data, methods: sendmsg, getmsg
  • helper methods: getReplID, replAcceptMsg, getThreadName, getSelfName, allowsuspend
  • threads can be suspended, resumed and killed, methods: suspend, resume, kill
  • list method, list running/suspended threads to screen or return tuple with threads information
Multiple threads can run smoothly, for example I'm running 5 threads for more than 24h without any problem:

Code: Select all

>>> _thread.list()
ID=1073548004 Name: Neopixel State: running
ID=1073413296 Name: BME280 State: running
ID=1073412568 Name: FTPServer State: running
ID=1073411840 Name: B_Led State: running
ID=1073411360 Name: R_Led State: running
ID=1073454488 Name: MainThread State: running
>>> 
[Message from thread "BME280"] [12:02:24] T=26.92C  P=1004.63hPa  H=55.77%
[Message from thread "BME280"] [12:03:32] T=26.89C  P=1004.62hPa  H=55.11%
>>> _thread.notify(npth,1000)
True
>>> 
[Message from thread "Neopixel"] [Neopixel] Run counter = 888279
>>> 
>>> _thread.suspend(bth)
True
>>> _thread.list()
ID=1073548004 Name: Neopixel State: running
ID=1073413296 Name: BME280 State: running
ID=1073412568 Name: FTPServer State: running
ID=1073411840 Name: B_Led State: suspended
ID=1073411360 Name: R_Led State: running
ID=1073454488 Name: MainThread State: running
>>>
  • B_Led & R_Led blinking leds for 100 ms every second
  • BME280 reading BME280 sensor data using hwI2C and sending inter-thread message to main (repl) thread, accepts notifications for changing/disabling report interval and measure&report on request
  • Neopixel cycling rainbow colors thru 24 WS2812 RGB leds, accepting inter-thread notifications to change brightness and report counter status
  • FTPServer running python FTP server
Repl still runs smoothly, without noticeable effects on other threads even when performing such a task as downloading the file from ftp server.

Check GitHub repository for more info and sources.

User avatar
mattyt
Posts: 410
Joined: Mon Jan 23, 2017 6:39 am

Re: MicroPython on ESP-WROVER with 4MB of psRAM

Post by mattyt » Sun Aug 20, 2017 2:57 pm

This is fantastic work Loboris! There's so much going on I'm struggling to keep up... :)

I"m looking forward to getting a WROVER to try out the extended RAM.

What is your plan with merging back up to the main Micropython ESP32 port? Your fork has drifted some way from 'just' using psRAM and there are a lot of changes that look challenging to reconcile. I'd love to see your work come back into the main port and can try to help - if that's your goal.

I had started looking into improving the Neopixel implementation (see issue 159) but your code looks like it already has all the features that had been discussed! Perhaps we could start by merging this back...

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

Re: MicroPython on ESP-WROVER with 4MB of psRAM

Post by loboris » Sun Aug 20, 2017 3:46 pm

I have some specific needs, so I have to "drift away" from main MicroPython port sometimes. Of course, I'd be happy to see some of my changes and additions in the main port, I'll try to prepare some PR's when I'll find some time.
Some of the changes are easy to pull to the main port as they do not collide with existing modules or MicroPythons's 'philosophy', a good and simple example is the Neopixel module.
Some other (like my work on treads) are harder to port back, as they requires more changes.

My programming 'philosophy' is also different from the main MicroPython's, as I think that as much work as possible has to be done in C and use Python for more complex high level programming.

Now I'm working on GSM module which uses PPPoS for Internet connection so that all nettwork related modules and methods can be used the same way as with WiFi. I'll try to implement it in a way that it can be easily merged with the main Micropython port.

cable134
Posts: 28
Joined: Sun Aug 20, 2017 10:51 pm

Re: MicroPython on ESP-WROVER with 4MB of psRAM

Post by cable134 » Wed Aug 30, 2017 7:55 pm

Dear loboris,
first of all, I'd like to tell you a lot of thanks for your awesome job.

I built MicroPython_ESP32_psRAM_LoBo firmware for my ESP-WROOM-32 board.
Just enabled:
CONFIG_MICROPY_PY_FRAMEBUF=y
CONFIG_FREERTOS_UNICORE=y

Then, I tried to execute some code and got a crash.
"Guru Meditation Error of type LoadProhibited occurred on core 0. Exception was unhandled."
The same code works fine on the firmware from https://github.com/micropython/micropython-esp32.git

Could you please review my report ?
Should I tune something in the build settings for the ESP-WROOM-32 board to avoid a crash ?

Official fw https://pastebin.com/4DPhmLkY
and Halted MicroPython_ESP32_psRAM_LoBo firmware https://pastebin.com/mcrfe7Zh

Thank you in advance.

Post Reply