MicroPython on ESP32 with SPIRAM support

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

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Fri Jan 19, 2018 8:51 am

OutoftheBOTS_ wrote:
Fri Jan 19, 2018 8:31 am
@laboris

Question on your timer. Are they the same timers used for PWM i.e if I am already using timer 0 to timer 2 for PWM generation and I want to make a call back timer I must use timer 3 ???

I am using timer 0 for 20mhz clock signal for the counter chip, I am using timer 1 and timer 2 for speed control of 2 motors and I want to use a call back timer so that every 200ms it will read the encoder counter chip and adjust the motor speed PWM if the motor is at incorrect speed
The Timer module uses ESP32 64-bit general-purpose timers, while PWM module uses ESP32 pwm peripheral which has its own timers, so they can be used independently.

ESP32 also has a special peripheral for motor and power control.
The module using this peripheral will be implemented probably next month.
The Motor Control Pulse Width Modulator (MCPWM) peripheral is intended for motor and power control. It
provides six PWM outputs that can be set up to operate in several topologies. One common topology uses a pair
of PWM outputs driving an H-bridge to control motor rotation speed and rotation direction.

demoontz
Posts: 18
Joined: Wed Feb 15, 2017 12:39 pm

Re: MicroPython on ESP32 with SPIRAM support

Post by demoontz » Fri Jan 19, 2018 12:25 pm

Hello all!
could someone please describe what needs for compile firmware for windows?
which soft should be install?
second q:
which soft best to use for develop-debug?
for 8266 i use mpfshell to upload by com. but here its not working.
do someone use pycharm?
thanx!

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

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Fri Jan 19, 2018 1:10 pm

demoontz wrote:
Fri Jan 19, 2018 12:25 pm
Hello all!
could someone please describe what needs for compile firmware for windows?
which soft should be install?
thanx!
Introduction

Windows doesn’t have a built-in “make” environment, so you will need a GNU-compatible environment.
Espressif uses the MSYS2 environment to provide this.
You don’t need to use this environment all the time (you can use Eclipse or some other front-end), but it runs behind the scenes.

Toolchain Setup

Download the Windows all-in-one toolchain & MSYS2 zip file from dl.espressif.com:

https://dl.espressif.com/dl/esp32_win32 ... 180110.zip

Unzip the zip file to C:\ (or some other location, but this guide assumes C:\) and it will create an msys32 directory with a pre-prepared environment.

Check it Out

Open a MSYS2 MINGW32 terminal window by running C:\msys32\mingw32.exe.
The environment in this window is a bash shell.

Image

Use this window in the following steps setting up development environment for ESP32 MicroPython.

Setup MicroPython build environment

In open mingw32 window run the folowing commands:
  • Clone the repository:

    Code: Select all

    git clone https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo.git
    
  • Change the working directory to MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD

    Code: Select all

    cd MicroPython_ESP32_psRAM_LoBo
    cd MicroPython_BUILD
    
  • First you must run menuconfig to create the default sdkconfig configuration file

    Code: Select all

    ./BUILD.sh menuconfig
    
    On first run esp-idf and toolchain wil be unpacked.
    On windows you may get false error unpacking 'esp-idf' FAILED.
    Just run ./BUILD.sh menuconfig again, the toolchain will be unpacked successfully.
    In menuconfig change the com port to windows COMx which is used to comunicate with your ESP32 board.
    → Serial flasher config → Default serial port
    You don't need to change anything else to build the default firmware. Later, you may want to configure the MicroPython build to better suit your needs.
  • Builld your MicroPython firmware:

    Code: Select all

    ./BUILD.sh all
    
  • and flash it to your ESP32 board:

    Code: Select all

    ./BUILD.sh flash
    
  • You may now connect to you board, run:

    Code: Select all

    ./BUILD.sh monitor
    
    or use some other serial terminal program, like Putty, to connect to the board.
You can also consult the Build Wiki to learn about more build options.

If you are using Windows 10, you can also install Windows Subsystem for Linux and build the same way as on Linux.
To enable serial port support on the Windows Subsystem for Linux read this.
The instructions under Setup MicroPython build environment are the same.

demoontz
Posts: 18
Joined: Wed Feb 15, 2017 12:39 pm

Re: MicroPython on ESP32 with SPIRAM support

Post by demoontz » Fri Jan 19, 2018 1:53 pm

AWESOME!
many thanx!
now its works. =)

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

Re: MicroPython on ESP32 with SPIRAM support

Post by cartere » Fri Jan 19, 2018 10:57 pm

@laboris thanks so much for the wiki update on windows install, finally go it working! Quick question on pulsein functionality, I have been trying to get it to work using Pin irq's and not having much luck. I have read that the pwm hardware can be used for input capture, is that functionality exposed in your software somewhere?

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

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Wed Jan 24, 2018 12:02 am

my lolin32 pro board seems to have died.

When I plug it in to my computer the recognizes the CP210 but the Wrover module starts to get very hot and I can't get any coms to it.

Has anyone else had this problem??

Also the Lolin32 pro seems to have disappeared from any seller does anyone know if it has gone out of production?? maybe there was a problem with it?

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

Re: MicroPython on ESP32 with SPIRAM support

Post by mattyt » Wed Jan 24, 2018 2:26 am

I have had that exact problem with one of my Lolin32 Pro's too (and I haven't yet tried the second unit that I bought). Haven't yet had a chance to diagnose the issue...will try to do so in the next couple of days.

It is a bit suspicious that they've been pulled from the store!

User avatar
Roberthh
Posts: 2136
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: MicroPython on ESP32 with SPIRAM support

Post by Roberthh » Wed Jan 24, 2018 8:34 am

I bought two LOLIN32 Pro. They behave slightly different. One runs fine with the Pycom image, which uses a i80 MHz SPi clock, the other reboots when just sitting silent in the REPL prompt after some time, which is between a few mionutes and several hours. Using the Microypthon.org or @lobiris image with it's 40 MHz SPI clock, it works fine.

Side note: The 80 MHz SPI clock makes the device feel much more 'snappy'.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Wed Jan 24, 2018 8:51 am

has anyone else had any problems with other boards that use the Wrover module or is it only the Lolin32 Pro that seems to be having problems??

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

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Wed Jan 24, 2018 9:11 am

I'm using Lolin32 Pro for a week and had no problems.
I'm always configure it to run with Flash @80 MHz in QIO mode and psRAM @ 80MHz.

I'm also using ESP32-WROVER-KIT v3 for 6 months and had no problems with the same configuration.

Post Reply