Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Support for Adafruit Metro M4 Express Airlift #694

Merged
merged 5 commits into from
Nov 15, 2019

Conversation

bgould
Copy link
Member

@bgould bgould commented Nov 6, 2019

Link: https://www.adafruit.com/product/4000
Schematic: https://cdn-learn.adafruit.com/assets/assets/000/075/654/original/adafruit_products_schem.png?1557700681

So far it works to flash blinky1 onto the board. I still need to test the serial peripherals and the onboard neopixel. Additionally I need to add pin mappings and another SPI for communicating with the integrated ESP32.

Doing an initial commit now to make sure it makes through CI jobs alright.

@bgould bgould changed the title Additing Support for Adafruit Metro M4 Express Airlift (WIP) Adding Support for Adafruit Metro M4 Express Airlift (WIP) Nov 6, 2019
@deadprogram
Copy link
Member

This is excellent! Let me know if i can help out in any way, although I do not have the particular board.

Regarding the ESP32, I think the ideal situation would be to add the SPI interface support to the current espat driver (https://github.com/tinygo-org/drivers/tree/master/espat) to allow using either the UART or SPI in a similar way to how the SSD1306 drivers works (https://github.com/tinygo-org/drivers/blob/master/ssd1306/ssd1306.go#L52-L75) although the SSD1306 is SPI/I2C the concept should be similar.

What do you think?

@bgould
Copy link
Member Author

bgould commented Nov 6, 2019

FYI I read the schematic wrong the ESP32 looks like it is on SPI0 but is also connected to a UART interface that is not in the board definition yet.

I'm interested in what you are saying about adding support to the espat library, I'm just trying to understand what that will entail. Does that require a different frimware to be installed on the esp32 chip? I found Adafruit's circuitpython driver for the firmware that is on the chip from the factory but at a glance it doesn't look like it is an AT-style protocol, but maybe the binary "commands" map to AT commands in Espressif's firmware (I need to read it more closely to understand I think). It does look like there is some sort of framing of "packets" being done that the request-response communication is implemented on top of; so if the commands line up with AT commands I think your idea is totally doable (source: https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/blob/master/adafruit_esp32spi/adafruit_esp32spi.py)

Or maybe I am misunderstanding what you mean, it is late here :) In any case I'm down to get it working, I need MQTT so espat would really help me

@deadprogram
Copy link
Member

The ESP32/ESP8266 official firmware is this: https://github.com/espressif/esp-at

It supports either AT commands over UART or AT commands over SPI.

The Adafruit and Arduino boards usually use the Arduino WifiNina firmware which is an entirely different API: https://github.com/arduino-libraries/WiFiNINA

Regarding the UART on that board, it is common to use the SPI interface to the ESP* boards for commands and the UART for debug output.

The ESP32 is probably wired for this scenario on that board.

Anyhow, the TinyGo espat driver works only with the official firmware from espressif.

@bgould
Copy link
Member Author

bgould commented Nov 6, 2019

Ok I will dig into it, get this flashed and see if I can at least verify that I have the correct pins mapped so that the communication is working, and then jump over to the drivers repo for the rest of that work I guess. As an aside I just noticed the 2.0.0.0 release for that firmware cut 2 days ago with shiny new AT commands for BLE HID devices as well as AT commands for MQTT apparently (!): https://github.com/espressif/esp-at/releases/tag/v2.0.0.0_esp32

@deadprogram
Copy link
Member

We perhaps do not want to drag the wifi chip into the base implementation for the board itself. That was my mistake probably. If the pins work as mapped on the expected peripherals then probably it is enough for this PR.

@bgould
Copy link
Member Author

bgould commented Nov 13, 2019

Sounds good. I think I have at least enough code written for the wifi chip to confirm that the pins are correct. I will do a few final tests make sure everything is ready to merge.

@bgould bgould changed the title Adding Support for Adafruit Metro M4 Express Airlift (WIP) Adding Support for Adafruit Metro M4 Express Airlift Nov 15, 2019
@bgould
Copy link
Member Author

bgould commented Nov 15, 2019

I've completed my testing and I think this board should be good to go now.

@deadprogram
Copy link
Member

Looks great @bgould thank you very much for another great contribution. Now squash/merging.

@deadprogram deadprogram merged commit 009b273 into tinygo-org:dev Nov 15, 2019
@bgould bgould deleted the metro-m4-airlift branch November 16, 2019 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants