Multiple OpenMV

Greetings and thank you for any advice. New to programming and OpenMV.
I wish to know how to use the RPC library (SPI) with two OpenMV Cans. I have tried to connect my two OpenMV (Slave) to my Teensy 3.2 (Master), but can’t seem to get around " openmv::rpc_spi_master interface(10, 1000000, SPI_MODE2)" for assigning two different pins (chip select).
Tried using “Remote Control - As The Controller Device”. but can’t have more than one “interface”.
I’m simply trying to received centroid data from two different OpenMVs and put it into two differnt arrays.
Thank you for your time and effort.

What’s the error exactly? Does the library not compile on the Teensy? If so, I’ve never target the library for that platform so I don’t know if it does.

Thank you for responding so quickly Kwabena,

The teensy works quite well.
Here is what I have done:

I down loaded the “ popular_Features_as_the_remote_device “ into camera one, Using the SPI protocol.

I selected at the bottom : interface.register_callback(color_detection),
With the interface.loop().

To my Teensy, I downloaded the Arduino’s “ Remote Control - As The Controller Device “
And “ openmv::rpc_spi_master interface(10, 1000000, SPI_MODE2); “
Note that pin 10 is one of the parameters.

On camera Two, I also downloaded : “ popular_Features_as_the_remote_device “ into camera two, Using the SPI protocol.
But changed openmv::rpc_spi_master interface(10, 1000000, SPI_MODE2); “ to openmv::rpc_spi_master interface_Rt(6, 1000000, SPI_MODE2); “

It seems I can’t have two Masters.
Question: How can I declare both pin 6 and pin 10 in the Teensy ?

I’m trying to have another openmv::rpc_spi_master interface(6, 1000000, SPI_MODE2); “.

So simple but, can I have data from each camera (SPI) be collected by one Teensy (Master)?

I really appreciate you taking the time to answer my question.



Well, the protocol is master/slave. So, either the camera has to be a master or it has to be a slave. Or the teensy.

Anyway, you need to create two spi_master objects if you want two SPI interfaces to control two cameras.

Thank you for responding Kwagyeman. Being new to Object oriented Programming, is there an example on how to create two spi_master objects? Does the code go inside the Teensy sketch or the OpenMV IDE sketch? Sorry for the elementary questions.

There’s no example, but, it’s explained in the extensive documentation for the library on github. You just create a second copy of the object and give it a different SPI CS pin.