Hi,
I have three OpenMVs. I want to make one OpenMV act as a controller and another two OpenMVs will receive the signal from the controller for capturing scenes synchronously. Then the controller can also receive two scenes from that two OpenMVs and make sure the two scenes are captured at the same time. I first try to use SPI protocol to test between two OpenMVs making one act as a master and another a slave (Pin connection: Master.P0–>Slave.P1, Master.P1–>Slave.P0, Master.P2–>Slave.P2, Master.P3–>Slave.P3, Master.GND–>Slave.GND). The codes in the Master and the slave are very simple:
#Master
from pyb import Pin, SPI
cs = Pin(“P3”, Pin.OUT_PP)
cs.high()
buf = ‘a’
The hardware SPI bus for your OpenMV Cam is always SPI bus 2.
spi = SPI(2, SPI.MASTER, baudrate=115200, polarity=0, phase=0)
while(True):
cs.low()
spi.send_recv(buf,buf,timeout=500)
print(buf)
cs.high()
#-------------
#Slave
from pyb import SPI, Pin
cs = Pin(“P3”, Pin.IN)
cs.high()
buf = ‘b’
spi = SPI(2, SPI.SLAVE, baudrate=115200, polarity=0, phase=0)
while(True):
cs.low()
spi.send_recv(buf,buf,timeout=500)
print(buf)
cs.high()
However, those codes do not work (of course the Pin connection maybe is wrong, because i am a novice). Therefore, who can help me for my purpose, thanks very much.