SPI communication with ESP32

I have an OpenMV model H7 R2 and I’m trying to send information via SPI bus from openMV to an ESP32. I have configured openMV as master using the pyb method, and I have configured the ESP32 as slave using specific library in arduino IDE.

In the openMV code after i configure andinitilize the SPI bus, i’m running a simple code inside a while loop to send 1 byte a time. On the ESP32 i’m running a simple code to read the byte received and print it on the serial terminal. But, i’m not getting anything on the ESP32. I’m using arduino IDE to program my ESP32.

I tested the ESP32 code using a raspberry pi 4 to send one byte through SPI and in that case it worked as expected.

On the other hand, i saw there is an SPI method on the machine library which i also tried to implement and it didn’t work either.

Lastly, i saw there is aslo an SPI method in the RPC library, and reading on other topics i saw you can implement the method using arduino downloading the openMV library, but when i tried to download it, is not working. I’m using arduino version 2.0.3.

My question is, what’s the proper way to implement SPI bus communication between OpenMV and other microcontrollers?

I uploaded the code i’m using on my openMV.

SPI_TEST1.py (345 Bytes)

I’ would appreciate any clarification on this topic.

Hi, you really want to use the RPC library. It is very robust for this.

As for the RPC library not working… does it not compile? Or does it just not work?

Without using the RPC library I can’t offer help support. Getting SPI operational is hard. I’d recommend async serial as that’s easier. But, it requires you to have an extra uart.

I cannot install the OMV library on arduino IDE.

Hi, thanks for pointing that out. I think there was an issue with the library properties value. I just fixed that. It will take a day or so for the Arduino IDE to see the fix.

In the mean-time. You can manually install the library by downloading this as a zip file:

And putting that into your Arduino/Libraries folder under your username on your PC. Arduino IDE should find the library then.