I am trying to write a byte (Register address) to an accelerometer SPI slave to get the value of this register in the same tranfer.
As I understand the code of the function -> spi_transfer(SPI_dev,Tx_buff,Rx_buff,size), The first byte in the TX_buff must be the register address of the slave and I have to set the next bytes of this buffer to 0xFF to do "as if" Nothing was transfered after the first byte(In the fact, there is a tx followed by a rx before incrementing the "transfer byte").
It doesn't works as I want! It returns Something like -22 or Something like the number of bytes transfered (seems to be like). But the return value must be 0 if all run successful...
In the first param of the function, I just wrote SPI0 (there is only one generic spi device)
I am wondering if it is possible to do like that. ...Or is it not possible to do a 1 byte write followed by a multibyte read in one transaction? Without /CS going high in the mean time?
Thanks for the help!