Note that I’ve used this same construct with I2C with the only needed change is from spi to i2c for the interface definition.
Full error output here:
Traceback (most recent call last):
File "<stdin>", line 42, in <module>
File "rpc.py", line 602, in put_bytes
AttributeError: 'rpc_spi_slave' object has no attribute '_put_short_timeout'
OpenMV v4.5.0; MicroPython v1.20-omv-r8; OPENMV4-STM32H743
Is there another SPI option? Other posts caution against writing my own interface. Or does the “Arduino” example, with the interrupt callback, work well?
Ultimately, I’m using the library to pass April Tag info (for a course in robotics). I just queue up the tags and send to the master robot. I’ve gotten both UART and I2C working with rpc, but I’d like to throw SPI at the students, as well.
Oh, also, the link you provided just comes back to this post. Did you link the right page?
So, there’s something wrong with SPI control. The code was not touched but broke due to firmware updates. So, I need to hunt down what’s wrong. SPI master mode doesn’t work either.
Unfortunately, I’m not at home with all my equipment right now so I cannot debug the issue currently. However, I should be able to take a look after December 6th.
I know SPI master mode doesn’t work. The error you mentioned is different though. SPI slave mode may work if the missing attribute is fixed. Let me try a fix really quick.
Yeah, so, what you are doing doesn’t work… you shouldn’t call put_bytes until the link is up.
This is unrelated to the SPI master mode not working currently. You should be able to get SPI slave mode working if it’s still operational by using the RPC calls first before calling put_bytes.
…I’m not really using the rpc library in the way it was designed: For example, with the i2c interface, I’m not making remote function calls, per se. I just use put_bytes on the OpenMV to load up a buffer and then I use regular calls from the master to get data (eg, requestBytes()), mostly so I could walk students through how an I2C transaction works. Since the interrupt for a ST signal on the I2C bus is buried so deep in uPython, co-opting the rpc library was the easiest solution.
It’s working fine for I2C…I might just try to make my own SPI interface from the example. I’m just sending april tag data, so it’s hardly a lot of data.