0

Trying To run the demo from the Airlift Shield
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Trying To run the demo from the Airlift Shield

by rgbaal on Fri Apr 16, 2021 6:28 pm

I am trying to run the demo code from the airlift ESP32 Wifi page, but I am getting a memory allocation error. It can't be that I have assembled the kit incorrectly as its not getting that far!
----
main.py output:
Traceback (most recent call last):
File "main.py", line 5, in <module>
File "adafruit_esp32spi/adafruit_esp32spi.py", line 97, in <module>
MemoryError: memory allocation failed, allocating 96 bytes

Code done running.
------

I have not made any changes to the code - it is just a cut and paste - what could I be doing wrong? the libraries seem to import correctly

completely lost.

Code below
Thanks Bob

------


import board
import busio
from digitalio import DigitalInOut

from adafruit_esp32spi import adafruit_esp32spi

print("ESP32 SPI hardware test")

esp32_cs = DigitalInOut(board.D10)
esp32_ready = DigitalInOut(board.D7)
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)

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("Done!")

rgbaal
 
Posts: 2
Joined: Fri Apr 16, 2021 6:23 pm

Re: Trying To run the demo from the Airlift Shield

by dastels on Sat Apr 17, 2021 10:02 am

Are you running on a MetroM0 by any chance?

As stated on the Airlift shield product guide https://learn.adafruit.com/adafruit-airlift-shield-esp32-wifi-co-processor:

It also works great with CircuitPython, a SAMD51/Cortex M4 minimum required since we need a bunch of RAM.


Dave

dastels
 
Posts: 6787
Joined: Tue Oct 20, 2015 3:22 pm

Re: Trying To run the demo from the Airlift Shield

by rgbaal on Sat Apr 17, 2021 2:04 pm

dastels wrote:Are you running on a MetroM0 by any chance?

Dave


Ahh I have bought the wrong card - I thought I was buying an M4 but it seems I had a senior moment and bought a M0 by mistake!

Thats what it will be, thanks for your help.

Bob

rgbaal
 
Posts: 2
Joined: Fri Apr 16, 2021 6:23 pm

Re: Trying To run the demo from the Airlift Shield

by dastels on Sat Apr 17, 2021 3:21 pm

The M0 board will be more than enough if you use C++. It's just that CircuitPython code takes up ram (), whereas C++ code lives in flash, leaving ram for data. CircuitPython, itself, is a C++ program in flash.

An M4 board is a great choice for some moderately significant CircuitPython programs.

Dave

dastels
 
Posts: 6787
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.