This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux: false SPI transfer number



Tool/software: Linux

Hi,

I need to send 16 word bits per transfer but the chip select and clock signal remain active for two word transfers...that is there are sent to words of 16 bits instead of one. What could be wrong?

Here is my code:

static int fd,ret        = -1 ;
uint16_t u16_tx[1]  = {0x5050}; 

memset (&msg, 0, sizeof (msg));

msg.tx_buf              = (unsigned long)u16_tx;
msg.len                   = 2;                                         /* 2 bytes, 1 word of 16 bits*/
msg.speed_hz        = 5000;
msg.bits_per_word = 16;                                       /* 16 bits per word */

if (fd < 0)
{
  fd = open (SPI_OUTPUT_DEVICE, O_RDWR); /* open devices file */
}

ret = ioctl(fd, SPI_IOC_MESSAGE(1), &msg);

Thank you