Using that the slave mode for Micopython would not be required.nina-fw from Adafruit.
SPI synchronization between two devices
Re: SPI synchronization between two devices
-
- Posts: 969
- Joined: Sat Feb 03, 2018 7:02 pm
Re: SPI synchronization between two devices
exactly. the firmware is already done and has spi slave in c++. And the client side (e.g. rpi pico) uses SPI master. So no SPI slave needed in micropython.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: SPI synchronization between two devices
There is a potential snag with SPI.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: SPI synchronization between two devices
Seems the CircuitPython firmware does not work on ESP32, unfortunately. So the two emerging solutions would be to use UART (up to 5Mbit/s) or run an SPI slave (theoretically up to 10Mbit/s) on the ESP32 board by programming it directly in C/C++. I had a look at the Espressif SDK, there is a module dedicated to SPI slave. Seems they have it all covered, with a complete API and docs and even a good-looking example. If that's really working code, wrapping it up in an mpy module should not be too hard.
Kevin: keep us updated about your findings?
Thanks!
Kevin: keep us updated about your findings?
Thanks!
Re: SPI synchronization between two devices
There is a fork of the nina-fw used by sipeed. They have an ESP32 as wifi-copro for their MAxduino product, which itself uses MicroPython.
https://github.com/sipeed/Maixduino_esp32_fimware
So maybe you can get some inspiration from that. At a first glimpse I did not see much of documentation.
P.S.: Using an ESP32 as WiFi modem for an RP2040 seems odd, as we say in German (oddly translated) "throwing the ham at the sausage". There are other products with the rp2040 announced which have it at least all integrated in one module: https://blog.arduino.cc/2021/01/20/welc ... ntrollers/
https://github.com/sipeed/Maixduino_esp32_fimware
So maybe you can get some inspiration from that. At a first glimpse I did not see much of documentation.
P.S.: Using an ESP32 as WiFi modem for an RP2040 seems odd, as we say in German (oddly translated) "throwing the ham at the sausage". There are other products with the rp2040 announced which have it at least all integrated in one module: https://blog.arduino.cc/2021/01/20/welc ... ntrollers/
-
- Posts: 969
- Joined: Sat Feb 03, 2018 7:02 pm
Re: SPI synchronization between two devices
Absolutely. I flashed the nina-fw firmware onto my esp32 and a test sketch onto another esp32 but having trouble getting the wiring correctly done and it doesn't get a connection. I have posted on the adafruit forum and hoping for a reply.
It was a rather frustrating adventure diving through different documentations and even the code itself to actually see which pins are used because in all documentations they only refer to the pin labels on their adafruit boards which are nowhere to be found on my standard nodemcu esp32s and some pins (e.g. gpio0) aren't even exposed on these but used in the project..
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
Re: SPI synchronization between two devices
Robert: agreed, there are better solutions out there. Point is to provide some networking features to a microcontroller board that doesn't have any, making use of whatever hardware I happen to have on my desk -- and I have tons of cheap ESP32s gathering dust. The Arduino/Pico board is still weeks or maybe months away and I kind of like the idea of connecting several boards together to build something smarter than its individual components, possibly enhancing existing libraries or porting other pieces of firmware while doing so.
Didn't know the expression with sausage and ham In French they use a power hammer to smash flies.
Kevin: I feel your pain. Every one of my microcontroller boards has a different pin layout. The TTGO ones vary from one version to the next, it drives me crazy.
Didn't know the expression with sausage and ham In French they use a power hammer to smash flies.
Kevin: I feel your pain. Every one of my microcontroller boards has a different pin layout. The TTGO ones vary from one version to the next, it drives me crazy.
-
- Posts: 969
- Joined: Sat Feb 03, 2018 7:02 pm
Re: SPI synchronization between two devices
Please see this thread for future updates: viewtopic.php?f=21&t=9664&p=54429#p54429
(Just updated it with my results from today)
(Just updated it with my results from today)
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode