MicroPython on ESP32 with SPIRAM support

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Wed Jan 31, 2018 11:39 am

Has anyone else used the analog lamb Wrover breakout board?

It's schematic shows IO12 being pulled up to 3.3v see https://github.com/AnalogLamb/esp32/blo ... eakout.pdf

Yet the Wrover datasheet doesn't show to do this in the peripherals schematic see https://www.espressif.com/sites/default ... eet_en.pdf

Is it maybe a fault in the analog design?? has someone make the analog Lamb wrover breakout work??

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

Re: MicroPython on ESP32 with SPIRAM support

Post by cartere » Wed Jan 31, 2018 1:59 pm

OutoftheBOTS_ wrote:
Wed Jan 31, 2018 11:39 am
Has anyone else used the analog lamb Wrover breakout board?

It's schematic shows IO12 being pulled up to 3.3v see https://github.com/AnalogLamb/esp32/blo ... eakout.pdf

Yet the Wrover datasheet doesn't show to do this in the peripherals schematic see https://www.espressif.com/sites/default ... eet_en.pdf

Is it maybe a fault in the analog design?? has someone make the analog Lamb wrover breakout work??
I have got the board to work (sorta), pull enable and io0 high, boot switch to pull io0 low on power up. Serial connection through an Adafruit monitor cable, basically just using the breakout as a convenient place to solder the wrover module.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by mattyt » Wed Jan 31, 2018 2:46 pm

For the record, the second of my LOLIN32 Pro boards appears to be operating fine. No heat - and greeted by the friendly MicroPython 1.9.2 WebREPL when making a serial connection to the board...

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

Re: MicroPython on ESP32 with SPIRAM support

Post by cartere » Wed Jan 31, 2018 6:59 pm

I am working on a anemometer that has a magnet that closes a reed switch each revolution.

Code: Select all

from time import *
import machine
import network
pin22 = machine.Pin(22,machine.Pin.IN)

twind =ticks_ms()
windSpeed=0

def callback22(p):
    global twind
    global windSpeed
    a = ticks_ms()
    deltat= ticks_diff(a , twind)
    if deltat>25:
        twind=ticks_ms()
        windSpeed=(( 10000/(deltat)*306)/1000)
        #print(windSpeed)

def getSpeed():
    global windSpeed
    return windSpeed

pin22.irq(trigger=machine.Pin.IRQ_RISING, handler=callback22)
 
I have two issues, how to keep windSpeed in scope and time.sleep() seems to shut down the pin callback. Having to def getSpeed() would seem to be a hack. Do I need to look at threads for the pin callback?

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

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Wed Jan 31, 2018 8:21 pm

cartere wrote:
Wed Jan 31, 2018 6:59 pm
I am working on a anemometer that has a magnet that closes a reed switch each revolution.
The pulse module will be available soon (probably early next week) which will use ESP32 hardware peripherals to count pulses, measure pulse duration and/or frequency etc.
It will make that kind of tasks much easier and precise.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by cartere » Wed Jan 31, 2018 9:10 pm

thanks loboris!

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

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Wed Jan 31, 2018 11:23 pm

Ok at this point I feel like an idiot.

It seems it was the way I connected the usb to serial converter to the ESP32. Seems the TX on the converter needs to connect the RX on the ESP32. This is opposite of the labaling stem32 dev board that I have known as the blue pill.

On the up side I now make it go :) :) :)

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

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Thu Feb 01, 2018 9:27 am

I have had my robot up and driving around today and now need to start to hook all the peripherals up. I need to workout what pins I will ise for what( I am likely to use them all).

I want to make sure that I am not connecting something to a pin that shouldn't be used.

Can someone confirm that these pins are ok to use.

I assume that I can use pin 0 as a digital IO providing it isn't pulled low during boot???

I assume that I need to leave pin 2, 4, 12, 13, 14, 15 for the SD card in 4 pin mode and not connect anything else to them unless using SD card in SPI mode then fine to use???

Pin 5 is listed as VSPI in ESP32 datsheet but on Wrover scehmatic it isn't shown in blue as 1.8v, I am unsure if it is ok to use???

18, 19, 21, 22, 23, 25, 26, 27 are fine as digital IO pins

32, 33, 34, 35 can be used as analog input pins or digital IO pins.

I am unsure about 36, 39????

I very much assume that I shouldn'y ever connect anything to : SD0, SD1, SD2, SD3, CMD, CLK, 16, 17 as these are all listed in blue as 1.8v for the SPI RAM

Thanks for anyone that can help :)

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

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Thu Feb 01, 2018 11:43 am

OutoftheBOTS_ wrote:
Thu Feb 01, 2018 9:27 am
... Can someone confirm that these pins are ok to use ...
You are right about the pins usage.

Be carefull about using GPIO0. I think the high level is sampled only on boot from power up.

I wouldn't recommend usin the SDCard in SPI mode, there are known problems with using the SPI display and SDCard in SPI mode!
But, you can use it in 1-line SD mode, you will have 3 more pins left (only GPIOs 14,15 & 2 are needed).

If using GPIO 12 (MTDI) be very carefull not to pull it down during boot. If pulled low it will select 3.3V for Flash & SPIRAM power wich can (and probably will) damage both chips.

You can use pin 5 as you want.

You can use 36 & 39, they are input only pins.

Never use or connect anything to the pins marked with blue on schematics (external Flash can be connected to those pins, but special procedure and fuse programming must be used).

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

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Thu Feb 01, 2018 11:57 am

@laboris

Thanks for your help. This will allow me to make the most of the available pins, I think that I will nee all of them and will run the SD card in 1 line mode as will need the extra pins.

Hoping to run : SPI TFT, SPI touch, SD card, 2 x SPI encoder counters, H-bridge needing 4 output pins, ADC for battery monitor and still have space to hook up I2C sensors.

Can I use 36 or 39 as SPI MISO ??

Can I use 36 or 39 as ADC input for the battery monitor??

Post Reply