Thanks for your suggestion
I tried it and got the same result. It is just a quick cut in Python to write some zeros to pulse the clock line as as it reads and writes at the same time in RPi Python. In the data sheet for the LS7366R it says the chip ignores the MOSI input while writing to MISO, it just needs the clock line to pulse.
Here's my Micropython code and u can see where I have copmment out a few other things that I tried, all had same result. I think that maybe I am using the SPI wrongly??
Code: Select all
from machine import Pin, PWM, SPI
import time
spi2 = SPI(1, baudrate=10000000, polarity=1, phase=0, sck=Pin(14), mosi=Pin(13), miso=Pin(12))
spi2.init(baudrate=10000000)
cs = Pin(15, Pin.OUT)
cs.value(0)
spi2.write(b'\x20') #clear counter
cs.value(1)
cs.value(0)
spi2.write(b'\x30') #clear status
cs.value(1)
cs.value(0)
spi2.write(b'\x88\x03') #set MDR0 to 4 counts per cycle
cs.value(1)
time.sleep(1)
cs.value(0)
spi2.write(b'\x90\x00') #set MDR1 to 4 byte counter
cs.value(1)
buf = bytearray(4)
cmd = bytearray((0x64, 0, 0, 0, 0))
while True:
cs.value(0)
#spi2.write(b'\x60') #command to read counter
#data = spi2.read(4) #read 4 bytes
#spi2.readinto(buf, 0x60)
res= bytearray(5)
spi2.write_readinto(cmd, res)
cs.value(1)
print (res)