Metro M7 wifi

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
richpaul6806
 
Posts: 16
Joined: Sun May 21, 2023 12:39 am

Metro M7 wifi

Post by richpaul6806 »

I tried to follow the "CircuitPython WiFi" section of the metro M7 guide to confirm wifi connection and got: TimeoutError: ESP32 timed out on SPI select. Everything appears to be configured correctly. Any thoughts?

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

Re: Metro M7 wifi

Post by mikeysklar »

I pulled my Metro M7 out of the shrink wrap and was able to run the CircuitPython WiFi example code.

Here is what I did:

1) Install CircuitPython 8.2.0-beta0

2) Install the three necessary libraries from the latest CP-8.x MPY drop.

Code: Select all

/adafruit_bus_device
/adafruit_esp32spi
adafruit_requests.mpy
3) setup the settings.toml with my WIFI_SSID and WIFI_PASSWORD.

4) Update code.py with the stock WiFi example no modification required.

5) Watched console:

Code: Select all

code.py | 8.2.0-beta.0code.py | 8.2.0-beta.0ESP32 SPI webclient test
ESP32 found and in idle mode
Firmware vers. bytearray(b'1.7.4\x00')
MAC addr: ['0x78', '0xd2', '0x1f', '0xda', '0xd4', '0xd4']
        sesame mesh             RSSI: -52
        bolo5           RSSI: -54
        sesame mesh             RSSI: -61
        sesame mesh             RSSI: -70
Connecting to AP...
Connected to sesame mesh        RSSI: -51
My IP address is 192.168.86.33
IP lookup adafruit.com: 104.20.39.240
Ping google.com: 20 ms
Fetching text from http://wifitest.adafruit.com/testwifi/index.html
----------------------------------------
This is a test of Adafruit WiFi!
If you can read this, its working :)
----------------------------------------
                                                                                                                                              Fetching json from http://api.coindesk.com/v1/bpi/currentprice/USD.json
----------------------------------------
{'time': {'updated': 'May 24, 2023 21:20:00 UTC', 'updatedISO': '2023-05-24T21:20:00+00:00', 'updateduk': 'May 24, 2023 at 22:20 BST'}, 'disclaimer': 'This data was produced from the CoinDesk BANNED Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org', 'bpi': {'USD': {'code': 'USD', 'description': 'United States Dollar', 'rate_float': 26391.5, 'rate': '26,391.4645'}}}
----------------------------------------
Done!

User avatar
richpaul6806
 
Posts: 16
Joined: Sun May 21, 2023 12:39 am

Re: Metro M7 wifi

Post by richpaul6806 »

Metro M7 should have those 3 libraries as modules internal to the board.If you enter repl and type help ('modules') you can see them there. I think this tutorial is just a copy/paste from their other boards where that step is necessary. Regardless, I gave it a shot with those libraries manually added. Same result.

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

Re: Metro M7 wifi

Post by mikeysklar »

Have you started fresh with the firmware erase image?

Which version of CircuitPython are you running?

Downloads --> Files (last one)

User avatar
richpaul6806
 
Posts: 16
Joined: Sun May 21, 2023 12:39 am

Re: Metro M7 wifi

Post by richpaul6806 »

I successfully erased the firmware and decided to try again. Online tool still didnt work and neither did esptool so I tried the circuitpython code found at viewtopic.php?p=973521#p973521 again. For some reason I had to flip rx and tx pin order on the UART command (I dont remember doing that before) but I got it installed again and it appears to be working. Wish I knew what the issue was but at least it is working now.

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

Re: Metro M7 wifi

Post by mikeysklar »

This is helpful. Since the board is so new the docs and install scripts can use some tweaking.

I'll take a look at the rx/tx pins in the circuitpython script used for the AirLift update to make that easier for others.

The pins are backwards in the example code according to the docs.
classbusio.UART(tx: microcontroller.Pin | None = None, rx: microcontroller.Pin | None = None, *, rts: microcontroller.Pin | None = None, cts: microcontroller.Pin | None = None, rs485_dir: microcontroller.Pin | None = None, rs485_invert: bool = False, baudrate: int = 9600, bits: int = 8, parity: Parity | None = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64)
As you suggested. This needs to be changed:

Code: Select all

uart = busio.UART(rx, tx, baudrate=115200, timeout=1)

Code: Select all

uart = busio.UART(tx, rx, baudrate=115200, timeout=1)

Code: Select all

code.py | 8.1.0code.py | 8.1.0ESP32 Nina-FW
Resetting
Synced
Found: ESP32
MAC ADDR:  ['0xd4', '0xd4', '0xda', '0x1f', '0xd2', '0x78']

Writing NINA_W102-1.7.4.bin w/filesize: 1159168
Erase size 1159168, num_blocks 2264, size 512, offset 0x0000
Took 2.32s to erase 2264 flash blocks
Writing at 0x0011ae00... (100 %)Took 46.17s to write 1159168 bytes
Verifying MD5sum  80c2dfd8ad2e97b2c32899382860acb1
Resetting
I was able to also confirm the CP based update method worked on my board with the above change. I updated the guide notes script.

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

Return to “Metro, Metro Express, and Grand Central Boards”