For example, I'm sending this (as byterray):
Code: Select all
[254, 202, 1, 0, 170, 15, 62, 32, 1]
Code: Select all
[126, 74, 1, 0, 42, 15, 62, 32, 0]
Needless to say, it didn't do that yesterday, only change I made was that the pyboard is now running from the SD card and not the internal flash.
At the same time, the data I send from the pyboard to the Raspberry Pi is fine, except when it isn't. Sometimes this happens:
send from the pyboard:
Code: Select all
[254, 202, 1, 0]
Code: Select all
[0, 254, 202, 1]
This off-by-one-byte error also happens in a completely different project on completely different hardware with an atmel board running linux and an atxmega programmed in C++.
I'm using pyb.SPI on the pyboard, because machine doesn't seem to have a Slave mode.
Code: Select all
import micropython
micropython.alloc_emergency_exception_buf(100)
from pyb import SPI, Pin, ExtInt
spi = SPI(1, SPI.SLAVE, baudrate=10000)
def callback(trigger):
spi.send_recv(data.bytes, control.bytes)
data.struct.new = False
interrupt = ExtInt(cs, ExtInt.IRQ_FALLING, Pin.PULL_UP, callback)
while True:
...