ESP32 timed out on SPI select

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
chagrincyclist
 
Posts: 30
Joined: Sun Jun 07, 2020 10:03 am

ESP32 timed out on SPI select

Post by chagrincyclist »

I have been using the Airlift Breakout board very successfully to access the internet with an M4 Express Feather. However, when I try to use the Airlift Featherwing with the exact same M4 Feather and the exact same script, I get an error message "RuntimeError: ESP32 timed out on SPI select". I've rechecked my wiring a dozen times and am still getting the error.

Any thoughts on what's happening?

FYI - I am not actually stacking the Airlift Featherwing on the M4 Express Feather (for reasons I won't bother you with) but am attaching the 3V, GND, SCK, MISO, MOSI, CS, BUSY, RST pins via wires just as I do with the Airlift Breakout board (which works fine).

Thanks for your help.

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: ESP32 timed out on SPI select

Post by mikeysklar »

Okay so just to confirm.

Everything works with Airlift Breakout + M4 Express Feather

Nothing works with Airlift Featherwing + M4 Express Feather

Can you post a photo of the wiring and soldering with the "Airlift Featherwing + M4 Express Feather" combination?

Please post your code in CODE blocks.

Anything you see on the REPL console might also be helpful.

User avatar
tannewt
 
Posts: 3314
Joined: Thu Oct 06, 2016 8:48 pm

Re: ESP32 timed out on SPI select

Post by tannewt »

Please try 6.3.0 if you are using 7.x. There is a known issue here: https://github.com/adafruit/circuitpython/issues/5462

User avatar
chagrincyclist
 
Posts: 30
Joined: Sun Jun 07, 2020 10:03 am

Re: ESP32 timed out on SPI select

Post by chagrincyclist »

I will try CP 6.3. Before I do however, can you take a look at my wiring? I have attached a Fritzing image.

The M4 is stacked on the 2.9" Monochrome display. The Airlift Featherwing (which is the one not working) is connected to the M4 as shown in the Fritzing image. I'm using the A3, A4 and A5 pins of the M4 for the Reset, Busy and Chip Select assignments.

To repeat what I said in my earlier post, when I attach the Airlift Breakout to this same M4 and and Display using the same pins it works fine, but for some reason the Airlift Featherwing isn't working. Thanks. The reason I want to use the Featherwing is that I can stack it on the M4 by just soldering pins along one side of the board and then putting jumper wires across the board as I've shown. I can't stack the Airlift Breakout in that manner.

Thanks!!!!

Error Message after running script is: "RuntimeError: ESP32 timed out on SPI select".

Code: Select all

import board
import busio
import digitalio
from digitalio import DigitalInOut
import adafruit_requests as requests
import adafruit_esp32spi.adafruit_esp32spi_socket as socket
from adafruit_esp32spi import adafruit_esp32spi

# Get wifi details and more from a secrets.py file
try:
    from secrets import secrets
except ImportError:
    print("WiFi secrets are kept in secrets.py, please add them there!")
    raise

print("ESP32 SPI webclient test")

TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
JSON_URL = "http://api.coindesk.com/v1/bpi/currentprice/USD.json"

#If you have an AirLift Shield:
esp32_cs = digitalio.DigitalInOut(board.A5)
esp32_cs.direction = digitalio.Direction.OUTPUT
esp32_cs.value = True

esp32_ready = DigitalInOut(board.A4)
esp32_reset = DigitalInOut(board.A3)

spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)

requests.set_socket(socket, esp)

if esp.status == adafruit_esp32spi.WL_IDLE_STATUS:
    print("ESP32 found and in idle mode")
print("Firmware vers.", esp.firmware_version)
print("MAC addr:", [hex(i) for i in esp.MAC_address])

for ap in esp.scan_networks():
    print("\t%s\t\tRSSI: %d" % (str(ap["ssid"], "utf-8"), ap["rssi"]))

print("Connecting to AP...")
while not esp.is_connected:
    try:
        esp.connect_AP(secrets["ssid"], secrets["password"])
    except RuntimeError as e:
        print("could not connect to AP, retrying: ", e)
        continue
print("Connected to", str(esp.ssid, "utf-8"), "\tRSSI:", esp.rssi)
print("My IP address is", esp.pretty_ip(esp.ip_address))
print(
    "IP lookup adafruit.com: %s" % esp.pretty_ip(esp.get_host_by_name("adafruit.com"))
)
print("Ping google.com: %d ms" % esp.ping("google.com"))

# esp._debug = True
print("Fetching text from", TEXT_URL)
r = requests.get(TEXT_URL)
print("-" * 40)
print(r.text)
print("-" * 40)
r.close()

print()
print("Fetching json from", JSON_URL)
r = requests.get(JSON_URL)
print("-" * 40)
print(r.json())
print("-" * 40)
r.close()

print("Done!")
Attachments
Stock Ticker Wiring_bb.jpg
Stock Ticker Wiring_bb.jpg (818.74 KiB) Viewed 466 times

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: ESP32 timed out on SPI select

Post by mikeysklar »

The connection of pins 11/12/13 --> A3/A4/A5 seems to be a possible area of concern if those pins are not agreeing on what they are set at.

Can you try running the FeatherWing AirLift stacked on the M4 (no display) running CircuitPython 6.3.0 with 6.x libs?

I think that will be our fastest way to getting a working AirLift FW. Then we can proceed to with getting the AirLift FW working off the M4 as you had with the breakout and finally introduce the EPD.

User avatar
chagrincyclist
 
Posts: 30
Joined: Sun Jun 07, 2020 10:03 am

Re: ESP32 timed out on SPI select

Post by chagrincyclist »

OK I reloaded the M4 Express with CP 6.3 and the 6.3 version modules. Unfortunately the result was the same, it doesn't work with the Airlift Feather Wing but does with the Airlift breakout board. I will try wire the Airlift Feather Wing differently to see if it works - I just have to unsolder some wires.

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: ESP32 timed out on SPI select

Post by mikeysklar »

Thank you for trying loading CircuitPython 6.3 and matching lib modules.

By showing that the breakout works, but the FeatherWing does not it narrows down the issue to:

1) The FeatherWing requires different pin out code

2) The FeatherWing is running a different AirLift firmware

I'm pretty sure the problem is the 1st issue. Make sure you are running our simpletest code and modify the source for FeatherWing weather than breakout or shield.

https://github.com/adafruit/Adafruit_Ci ... pletest.py

uncomment these lines and comment out the default AirLift config.

Code: Select all

# If you have an AirLift Featherwing or ItsyBitsy Airlift:
# esp32_cs = DigitalInOut(board.D13)
# esp32_ready = DigitalInOut(board.D11)
# esp32_reset = DigitalInOut(board.D12)

Code: Select all

# SPDX-FileCopyrightText: 2019 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

import board
import busio
from digitalio import DigitalInOut
import adafruit_requests as requests
import adafruit_esp32spi.adafruit_esp32spi_socket as socket
from adafruit_esp32spi import adafruit_esp32spi

# Get wifi details and more from a secrets.py file
try:
    from secrets import secrets
except ImportError:
    print("WiFi secrets are kept in secrets.py, please add them there!")
    raise

print("ESP32 SPI webclient test")

TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
JSON_URL = "http://api.coindesk.com/v1/bpi/currentprice/USD.json"


# If you are using a board with pre-defined ESP32 Pins:
esp32_cs = DigitalInOut(board.ESP_CS)
esp32_ready = DigitalInOut(board.ESP_BUSY)
esp32_reset = DigitalInOut(board.ESP_RESET)

# If you have an AirLift Shield:
# esp32_cs = DigitalInOut(board.D10)
# esp32_ready = DigitalInOut(board.D7)
# esp32_reset = DigitalInOut(board.D5)

# If you have an AirLift Featherwing or ItsyBitsy Airlift:
# esp32_cs = DigitalInOut(board.D13)
# esp32_ready = DigitalInOut(board.D11)
# esp32_reset = DigitalInOut(board.D12)

# If you have an externally connected ESP32:
# NOTE: You may need to change the pins to reflect your wiring
# esp32_cs = DigitalInOut(board.D9)
# esp32_ready = DigitalInOut(board.D10)
# esp32_reset = DigitalInOut(board.D5)

spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)

requests.set_socket(socket, esp)

if esp.status == adafruit_esp32spi.WL_IDLE_STATUS:
    print("ESP32 found and in idle mode")
print("Firmware vers.", esp.firmware_version)
print("MAC addr:", [hex(i) for i in esp.MAC_address])

for ap in esp.scan_networks():
    print("\t%s\t\tRSSI: %d" % (str(ap["ssid"], "utf-8"), ap["rssi"]))

print("Connecting to AP...")
while not esp.is_connected:
    try:
        esp.connect_AP(secrets["ssid"], secrets["password"])
    except RuntimeError as e:
        print("could not connect to AP, retrying: ", e)
        continue
print("Connected to", str(esp.ssid, "utf-8"), "\tRSSI:", esp.rssi)
print("My IP address is", esp.pretty_ip(esp.ip_address))
print(
    "IP lookup adafruit.com: %s" % esp.pretty_ip(esp.get_host_by_name("adafruit.com"))
)
print("Ping google.com: %d ms" % esp.ping("google.com"))

# esp._debug = True
print("Fetching text from", TEXT_URL)
r = requests.get(TEXT_URL)
print("-" * 40)
print(r.text)
print("-" * 40)
r.close()

print()
print("Fetching json from", JSON_URL)
r = requests.get(JSON_URL)
print("-" * 40)
print(r.json())
print("-" * 40)
r.close()

print("Done!")

User avatar
chagrincyclist
 
Posts: 30
Joined: Sun Jun 07, 2020 10:03 am

Re: ESP32 timed out on SPI select

Post by chagrincyclist »

Mystery solved! I was not powering the Airlift Feather Wing properly. As you can see from my wiring diagram, I was not powering the Airlift all! I had no connection to the USB pin. I was confused that the 3V pin was power in but it's not. Works fine now.

I am able to stack the Airlift Featherwing on top of the M4 which is on top of the 2.9" E-Ink (see attached).
20211205_092201.jpg
20211205_092201.jpg (292.63 KiB) Viewed 244 times
This makes for a very neat hardware set-up. I did have to bring in more power as the USB to the M4 was not able to power all three boards. So the device will be powered by an external 5V power supply going to the USB pin which I know is not recommended but it seems to be working fine.[attachment=0]20211205_092252.jpg[/attachment.

Thanks for your help, if you think my power set-up is not good please let me know.
Attachments
20211205_092252.jpg
20211205_092252.jpg (223.06 KiB) Viewed 244 times

User avatar
danhalbert
 
Posts: 4686
Joined: Tue Aug 08, 2017 12:37 pm

Re: ESP32 timed out on SPI select

Post by danhalbert »

Glad you figure it out. It's a little hard to tell from the photo, but the usual arrangement is to solder full-length headers (12 or 16 pin) on each side of each board in the FeatherWing stack. Your FeatherWing should have come with the appropriate headers. It looks like you only added some wires to insert into the middle board in the sandwich from the top board.

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: ESP32 timed out on SPI select

Post by mikeysklar »

Good catch on the 3v line. I overlooked it in your diagram as well.

Just curious is it worth going the the Feather M4 Express + Featherwing Airlift + 2.9" versus using a MagTag?

https://www.adafruit.com/product/4800

As to your question about powering these devices do you have a USB current measuring device or used a multimeter to measure the current coming into the USB pin? I know the 3v3 regulator is good for 500mA on the Feather M4 Express.

User avatar
chagrincyclist
 
Posts: 30
Joined: Sun Jun 07, 2020 10:03 am

Re: ESP32 timed out on SPI select

Post by chagrincyclist »

I started off trying to use the.magtag but found the wifi range to be terrible...seems there is an antenna issue.

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: ESP32 timed out on SPI select

Post by mikeysklar »

I see. Thank you for the feedback.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”