MicroPython on ESP32 with SPIRAM support

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

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Thu Feb 22, 2018 3:04 pm

@OutoftheBOTS_

The problem is probably only the initialization sequence.
I'm working on some changes/updates to the display module.
It will be possible to to initialize the display without the fixed initialization sequence for defined types (tft.init(tft.GENERIC, miso=.......)), and do the initialization from MicroPython...

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

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Thu Feb 22, 2018 10:33 pm

I am also planning on my robots that have the room to use a 2.4" ili9341 screen with touch as a GUI, something like a basic menu-system that the user can use the touch to select up/down/select/back icons(be able to do basic things like log the robot on to there wifi router). I have already had my ili9341 screens working on your firmware but haven't yet tested the touch.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Sun Feb 25, 2018 11:29 pm

I assume this is a typo in your wiki and it should say XPT2046 ??
Touch panels based on XPT2066 and STMPE610 controllers are supported at the moment.

User avatar
on4aa
Posts: 70
Joined: Sat Nov 11, 2017 8:41 pm
Location: Europe
Contact:

Re: MicroPython on ESP32 with SPIRAM support

Post by on4aa » Wed Feb 28, 2018 2:07 am

loboris wrote:
Mon Feb 19, 2018 11:04 am
You can use i2c = I2C(-1, scl=scl_pin, sda=sda_pin) , the hw I2C 0 will be selected.
Is this already available in the prebuilt firmware?
Currently, any attempt to drive a Heltec SSD1306 OLED with the required software I2C fails with:

Code: Select all

OSError: I2C bus not available
EDIT
I guess not yet, since the prebuilt firmware version is:

Code: Select all

MicroPython ESP32_LoBo_v3.1.18 - 2017-02-07
Serge

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

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Wed Feb 28, 2018 4:07 pm

:!:
Updates summary:
February 2018.
  • Changed the method of passing parameters from tasks/events/interrupts to MicroPython callbacks.
    There were some issues/crashes on executing MicroPython callback functions scheduled from FreeRTOS tasks, FreeRTOS events or interrupts. This is now fixed, and no more crashes related to this should happen. Affected were mqtt, uart, network and GSM modules.
    • Updated MicroPython scheduler functions
    • Updated all affected modules
  • esp-idf sdspi_host driver refactored
    Using SDCard in SPI mode and display at the same time now works
    Tested on M5Stack & Adafruit 2.4" TFT Featherwing
  • Display module refactored
    • the display module now uses (modified) esp-idf spi-master driver
    • 16-bit color mode added, some operations are faster than with 24-bit mode
    • low level display functions added (setspeed, select, deselect, writecmd, writecmddata, readcmd)
    • get TP calibration constants function added
    • Backlight on/off function added
    • M5Stack display support added
    • M5Stack & GENERIC display types added
    • display initialization sequence for unknown display types can now be handled from MicroPython
    • tpcalib frozen module updated
    • added option to select rotation in init() method
    • added option not to display splash in init() method
  • I2C module completely refactored, now MIT licensed
    • SLAVE mode added
      • ESP32 hardware i2c can now be used in slave mode
      • special buffer (register array) is defined for master <-> slave communication
      • master can read or write data to MicroPython I2C slave
      • master can send arbitrary command (optionally with data) to MicroPython I2C slave
      • callback functions on i2c slave write, read and command
      • Wiki pages will be updatad with the complete information later today or tommorow
    • Low level I2C functions added
    • esp-idf i2c driver modified for better handling of the slave functions
  • UART module updated
    • added callbacks on data, pattern and error
    • added flush() method
    • some bugs fixed
  • SPI module updated, improved coexistence with other modules using the spi interface
  • network module updated, added callback function on WiFi events
  • machine module updated, added method for reading internal ESP32 temperature sensor
  • _thread module updated, status of the system tasks is now available in _thread.list()
  • uos module updated, SDCard mode can now be configured from MicroPython
  • utime & utimeq modules updated
    time.ticks_xx() functions now returns consistent tick count after time update (including NTP update)
    fixed handling if time values in utimeq
  • rtc module updated
  • ftp server updated, should now support many more FTP clients
  • Updated curl module, mail functions can now be excluded from build (via menuconfig)
  • uftpserver frozen module updated
  • microWebServer frozen module updated, WebSockets support added
  • Added MPU9250 frozen module (available on M5Stack)
  • sys.platform now returns 'esp32_LoBo' for better identification of this MicroPython port
  • Experimental Bluetooth support, not yet finished, do not use for now
  • Experimental support for FTDI EVE display modules, not yet finished, do not use for now
  • LICENSE file added
  • License information in many source files updated/added
Many Wiki pages are updated, the rest will be updatad in the next couple of days
.
.
You can support this project by donating via PayPal
Thanks to all who donated.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Wed Feb 28, 2018 8:57 pm

@laboris

Thanks for all your hard work. It is obvious that you have spent many hours in completing this and as a MIT license has made me compelled to make another small donation to support your work and I hope other follow :)

The ili9341 screen that I use has a super bright back light (4 LEDs, 1 in each corner of display) and at full on brightness it is a bit on the bright side. I can fix this in 1 of 2 ways either add a larger resistor to the LED+ pin of the display or use PWM duty to control brightness via software. To control via software is better as user can set it to their desired level or environment (outside/inside)

I can atm achieve PWM on back light pin by not declaring it in the display module and declaring it via machine module but it would be prettier code if it was able to all be done within the display module via declaring the timer and duty cycle. :)

Thanks for the MPU9250 support as thius is a very common chip that I use in my robots and was what I was using in the quadraped robot video that was leaning to stay level on un even ground :)

Thanks for the SPI mode for SD card as I may need to use this due to the fact that I am running out of IO pins :) even in 1 line mode :)

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

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Thu Mar 01, 2018 11:27 am

OutoftheBOTS_ wrote:
Wed Feb 28, 2018 8:57 pm
... but it would be prettier code if it was able to all be done within the display module...
It is planned and will be implemented soon.
OutoftheBOTS_ wrote:
Wed Feb 28, 2018 8:57 pm
...Thanks for the MPU9250...
I've only included it as frozen module. It was created by Mika Tuupola (micropython-mpu9250).
OutoftheBOTS_ wrote:
Wed Feb 28, 2018 8:57 pm
...Thanks for the SPI mode for SD card...
SDCard in SPI mode connected to the same (like on Adafruit 2.4" TFT Featherwing) or different (like on M5Stack) pins as display works quite good.
There is an "issue" however, if the image is displyed from the the sdcard, the operation is much slower (several times) then from the internal filesystem (the DMA transfer cannot be used with spi sdcard+display). I'll try to improve it.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Thu Mar 01, 2018 1:02 pm

Thanks tuupola for the MPu9250 driver. :)

At this rate I won't have any coding left to do as everyone seems to be writing it for me

User avatar
on4aa
Posts: 70
Joined: Sat Nov 11, 2017 8:41 pm
Location: Europe
Contact:

Re: MicroPython on ESP32 with SPIRAM support

Post by on4aa » Thu Mar 01, 2018 8:12 pm

Thanks loboris for your hard work!
Looking forward to the new I2C documentation, concerning software I2C on non-standard GPIO pins.
Serge

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

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Thu Mar 01, 2018 8:23 pm

on4aa wrote:
Thu Mar 01, 2018 8:12 pm
Looking forward to the new I2C documentation, concerning software I2C on non-standard GPIO pins.
Only hardware I2C is implemented, I don't see any reason to implement the software i2c.
I2C can be configured on any ESP32 GPIO (except on input only pins, 34-39).

I'm little late with documentation, but I expect to finish it tomorrow.

Post Reply