Alejandro-Dev Posted August 16, 2021 Share Posted August 16, 2021 From the example Digital_Spi.py I can get the following to work sending and receiving in the DD with a loopback cable: rgbTX = (c_ubyte*10)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) rgbRX = (c_ubyte*10)() rgdw = c_uint32() dwf.FDwfDigitalSpiSelect(hdwf, c_int(0), c_int(0)) # CS DIO-0 low dwf.FDwfDigitalSpiWriteRead(hdwf, c_int(1), c_int(8), rgbTX, c_int(len(rgbTX)), rgbRX, c_int(len(rgbRX))) # write to MOSI and read from MISO print("TX: "+str(numpy.fromiter(rgbTX, dtype=numpy.uint8))) print("RX: "+str(numpy.fromiter(rgbRX, dtype=numpy.uint8))) But I cannot get the same result using the individual write and read functions, like this: dwf.FDwfDigitalSpiWrite(hdwf, c_int(1), c_int(8), rgbTX, c_int(len(rgbTX))) # write array of 8 bit (byte) length elements dwf.FDwfDigitalSpiRead(hdwf, c_int(1), c_int(8), rgbRX, c_int(len(rgbRX))) # read array of 8 bit (byte) length elements print("TX: "+str(numpy.fromiter(rgbTX, dtype=numpy.uint8))) print("RX: "+str(numpy.fromiter(rgbRX, dtype=numpy.uint8))) Why is that? Link to comment Share on other sites More sharing options...
0 attila Posted August 23, 2021 Share Posted August 23, 2021 Hi @Alejandro-Dev The FDwfDigitalSpiWriteRead performs bidirectional transfer, sending out data on MOSI and receiving on MISO at the same time. The FDwfDigitalSpiWrite and FDwfDigitalSpiRead performs only one task at a time. Link to comment Share on other sites More sharing options...
Question
Alejandro-Dev
From the example Digital_Spi.py I can get the following to work sending and receiving in the DD with a loopback cable:
But I cannot get the same result using the individual write and read functions, like this:
Why is that?
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now