Other Parts Discussed in Thread: OMAPL138
Tool/software: Linux
Hello,
I am attempting to get SPI communication working on the new Processor SDK release of Linux for the OMAP-L138. On the previous SDK, MCSDK_1_01_00_02, I was able to get SPI working after changing the board configuration files, some light driver edits, and configuring the kernel for SPI in the user space. The user space software I wrote uses the spidev character device and ioctl calls.
Upon switching to the new SDK with Kernel 4.9.28, things have changed quite a bit. I modified the device tree, da850-lcdk.dts and configured the kernel for user space spi. The edits to the device tree look like this:
&spi1 {
status = "okay";
spidev@0 {
spi-max-frequency = <24000000>;
reg = <0>;
compatible = "rohm,dh2228fv";
status = "okay";
};
};
After this change, the device node /dev/spidev32766.0 appeared. I modified my code to open this device and attempted to execute it. The result was an error code -22, EINVAL. The ioctl was returning an invalid argument error. The section of my code that initiates the transfer is shown below:
struct spi_ioc_transfer tr = {
.tx_buf = (unsigned long)tx,
.rx_buf = (unsigned long)rx,
.len = len,
.delay_usecs = 1,
.speed_hz = 10000,
.bits_per_word = 8,
.cs_change = 0,
};
ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
where tx is a two character long buffer, len=2, rx=NULL, and fd is the file descriptor for /dev/spidev32766.0. The return value in this case is -1, and perror shows "invalid argument".
I am having a hard time figuring out what the invalid argument is, since this code worked without issue in the previous system. It is also puzzling why the spidev bus number is so high, and not '1' as it was in the past.
Any insight that can be provided is greatly appreciated.
Jeff