Watching the signals on my Logic analyzer everything seems fine
The code is basically the following:
Code: Select all
cs = machine.Pin(21, machine.Pin.OUT)
spi = machine.SPI(0, baudrate=10000, polarity=0, phase=0, bits=8,
firstbit=machine.SPI.MSB, sck=machine.Pin(18), mosi=machine.Pin(19), miso=machine.Pin(20))
def ping(spi, cs):
reg_write(spi, cs, REG_SPR, 0x55)
data = reg_read(spi, cs, REG_SPR)
print(data)
if data == 0x55:
print('pong')
else:
print('Error')
ping(spi,cs)
So from the image we see the initial write of 0x55 and afterwards we're reading the same reg and from the logic analyzer the device answers correctly with 0x55. However the output of micropython is:
Code: Select all
b'\x00'
Error