A few things I changed to make this work.
Rewrote the wiringPiSPIDataRW function to look like this:
int wiringPiSPIDataRW (int channel, unsigned char *data, int length)
{
struct spi_ioc_transfer spi[length] ;
int i = 0;
channel &= 1 ;
for (i = 0; i < length; i++){
memset(&spi[i], 0, sizeof (spi[i]));
spi[i].tx_buf = (unsigned long)(data + i) ;
spi[i].rx_buf = (unsigned long)(data + i) ;
spi[i].len = sizeof(*(data + i)) ;
spi[i].delay_usecs = spiDelay ;
spi[i].speed_hz = spiSpeeds [channel] ;
spi[i].bits_per_word = spiBPW ;
}
return ioctl (spiFds [channel], SPI_IOC_MESSAGE(length), &spi) ;
}
Apparently the memset is to null is necessary due to changes in the internal RasPi library. The for loop was added to create a separate transfer for each byte.
The data type for the data buffer in the s-function was changed to unsigned char.
The block sample mode was changed to discrete and set to the sample time of the full system.
Best Answer