I’m starting to use openmv and i need to know if the camera can works good in mode spi slave. I have tested more things with openmv IDE like for example:
1>>
but it always give me the same OSError : 16 , and the bus is not busy.
I have the problem with this line of my code too: data = spi.send_recv(b’\xff\xff’). The ide show me the same error. I have tested it changing the pins on hardware but i dont get it works well.
Hi, I thought I answered this a while back. Please see the Examples → Board Control → SPI Control Example. It shows how to drive our LCD shield in user space using the SPI code.
Yes, i did check this example and i modified repeatedly, my last try is:
import sensor, image, time
from pyb import Pin, SPI
spi = SPI(2, SPI.SLAVE, baudrate=int(1000000000/66), polarity=0, phase=1)
def wait_sync():
c = 0x00
while (spi.recv(c) == 0 ):
print("nothing")
if (spi.recv(c) != 0 ):
spi.send(c)
print ("sync done")
break
# Display On
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # must be this
sensor.set_framesize(sensor.VGA) # must be this
sensor.set_windowing((320, 240))
sensor.skip_frames() # Let new settings take affect.
clock = time.clock() # Tracks FPS.
print("Settings openmv ok")
while(True):
clock.tick() # Track elapsed milliseconds between snapshots().
img = sensor.snapshot() # Take a picture and return the image.
wait_sync()
spi.send(img)
print(clock.fps())
But the openmv ide give me the error 5 (OSError: [Errno 5] EIO) and right now i dont know like i can solve it…
I have seen the example of pixy with spi but i need more help … my master wait the same byte (0x88) of my slave but i cannot get it. My idea is transfer the image of openmv to my display. At the moment only show the picture.
Can you help me with the script of openmv , please? its complex for me…
Hi, do you have any documentation for the display. I’ll take a look.
That said, I’m generally unable to do coding for folks since I’m way to busy… if you send the documentation I’ll try to give you a write up of what to do but I wouldn’t wait on me for a solution.
I just hope a little help with this…because I cannot get the sync between the two devices…after of this I believe that I’ll be able to get the data through, but the bus error is difficult for me because I don’t understand why happen it.
Note that I don’t have your screen or even know what the protocol is… so, I’m not really sure how to help you…
If you want me to provide some useful answer you kind of need to narrow everything down to “one” line of code which is having the error. From the code you have for doing the sync I think you’re passing the variables to the receive command wrong.