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?