A number of posts on the forums have expressed interest in connecting the P2 to an ESP32, thereby giving the P2 access to the outside world. I’ve developed some code to do this as part of a larger project and thought I’d share it for others to use and improve upon. The 2 programs here will allow you to connect a P2-EVALB and an ESP32 module via an SPI link (here the ESP32 is the master running a 20 MHz SPI clock - and the P2 is the slave). The actual data transfer rate you'll achieve (measured for a 32k data transfer in either direction) is ~ 2.4 Mbytes/sec. An Adafruit (or similar) NeoPixel (8 x WS2812) strip connected to the P2 provides lots of visual feedback as the code runs.
My ESP32 code was developed using the Arduino IDE. I found and made use of an ESP32 DMA SPI library that was essential in getting this working without too much complexity on the P2 end – the relevant link to that is mentioned in the code comments.
To do this work I made a small PCB that has an ESP32 module riding piggyback on my P2-EVALB (the DipTrace schematic pdf shows the connections). The photo here is rather old – in current testing I’ve got the breakout PCB plugged into the P31..P16 headers on a P2-EVALB board, but just P19..16 are used for the 4 wire SPI bus and P20 for the LED string.
You’ll find lots of comments to explain what’s going on at either end of this SPI link. Once data is moved over to the ESP32 then you can send it off to the cloud or whatever else you so desire. The world literally is your oyster then !
I’ve been talking to this P2/ESP32 combo by sending messages from another ESP chip (an 8266) located over 1 km away – all just using the Espressif radios - but that’s another story….
n.b. The forum software did not allow the usual .ino file extension for the ESP32 Arduino IDE code so I've just changed it to .txt !