Page 1 of 1

SPI cannot use 16Bits words

Posted: Wed Mar 22, 2017 1:44 am
by Toubilou
Hi,
I am trying to control a function generator (AD9833) via SPI protocol and I saw that I am sending 8Bits words, which is actually stopping me from succeding the communication (it needs 16bits words). I tried a lot of different codes found on the internet, made my owns tests, including rasperry pi codes sometimes, and I cannot send 16 bits words.

The main problem is that when I try to change the bpw parameter to 16, it does not work(invalid argument). Of course, I saw on the datasheets that only 8 and 9 bits per words can be selected.

status1 = ioctl(fd1, SPI_IOC_WR_BITS_PER_WORD, &bits);
if (status1 < 0) {
perror("SPI_IOC_MESSAGE bla");
return 0;
}
I would like to know if you maybe knew a solution for my problem. I also tried sending char[2} at the same time with two8 bits words, doesn't work either. I think the best would be to have manually access to the CS pin, in order to maintain the low state longer? http://www.quanser.com/Products/quarc/d ... tocol.html
Sorry for the poor english, I am a young french engineer.
Thank you,
Clément =)