SPI : can't write LSB_FIRST flag (but read is OK)

Hi all,

I’m trying to use the SPI bus of a Jetson TK1 (setup with the Grinch kernel following the excellent tutorial of neurorobitics (http://neurorobotictech.com/Community/Blog/tabid/184/ID/15/Using-the-Jetson-TK1-SPI--Part-5-Programming-SPI-on-the-Jetson-TK1.aspx). Sending data on the SPI bus is OK in MSB first (by default).

The point is that the device I’m trying to drive is LSB first, so I’ve simply amend the dumpstat() method to write the LSB_FIRST flag. But whatever the value (anything different than O, including SPI_LSB_FIRST constant) I have a “Invalid argument” message from the ioctl() function.

Here is the piece of code which returns the error :

int DFSensor::configureSPIChannel ()
{
int ret = 0;
__u8 mode=0, lsb=SPI_LSB_FIRST, bitsr=8, bitsw;
__u32 speed=10000000;

...

else if (ioctl (_deviceHandle, SPI_IOC_WR_LSB_FIRST, &lsb) < 0)
{
    perror ("ERROR : SPI wr_lsb_first");
    ret = 2;
}

Any help is welcome :-)
Rgds,
Philippe

Hi affannato,

We’re no experience on this Grinch kernel issue, hope someone from community could provide the suggestion.

Thanks