WiringPi SPIDataRW with ADS1256

Hi everyone,

I am currently programming my Raspberry Pi 3B with a Waveshare AD/DA Expansion Board (https://www.waveshare.com/high-precision-ad-da-board.htm). The board contains an ADS1256 Analog-Digital-Converter and a DAC8532 Digital-Analog Converter.

Via the wiringPi library I am communicating with the board through SPI. With GPIO.SPIDataRW I am perfectly able to send data to the board, which I can see on the oscilloscope that it is correct. The ADS1256 reacts accordingly.

[code]Dim m as New MemoryBlock(1)
Dim Result as Integer
Dim Voltage(3) as Integer

m.byte(0)=&b11111100 'SYNC
Result = GPIO.SPIDataRW(SPI_CHANNEL, m, 1)

m.byte(0)=&b00000000 'WAKEUP
Result = GPIO.SPIDataRW(SPI_CHANNEL, m, 1)

m.byte(0)=&b00000001 'READDATA
Result = GPIO.SPIDataRW(SPI_CHANNEL, m, 1)[/code]

Since the code sample above sends a READDATA command to the ADS1256, it is supposed to return 24 bits with the binary value of the voltage at one of its previously selected inputs. Therefore I send another three bytes (&b11111111) to the device and can see on the oscilloscope that the chip is answering correctly. By counting the bits on the oscilloscope screen I can see “00011100 11010100 10010001”, which equals to 1889425 in decimals and with 5V reference voltage (1889425/2^23 * 5V) it equals 1.12V

However how would I receive these three bytes back correctly via GPIO.SPIDataRW? From the code below I would expect to have Voltage(0) until Voltage(2) filled with those values seen on the oscilloscope. However all of them are just “1”.

m.byte(0)=&b11111111 'Don't care Voltage(0) = GPIO.SPIDataRW(SPI_CHANNEL, m, 1) m.byte(0)=&b11111111 'Don't care Voltage(1) = GPIO.SPIDataRW(SPI_CHANNEL, m, 1) m.byte(0)=&b11111111 'Don't care Voltage(2) = GPIO.SPIDataRW(SPI_CHANNEL, m, 1)

Did anyone have a similar issue and found a solution?

Thanks a lot,

Julian