SPI under Linux

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi. Im running Linux 2.6.18 on a STK1000. I try to open the /dev/spi2 in order to communicate with outside devices.

The /dev/spi0..spi3 is visible in the filesystem, but they will not open as "file" ie. (open(), read() close() and so on), getting error message: "no such device or address".

Do I need to upgrade to a newer Linux version? Is there any compiled flash image newer than 2.6.18 available for download?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SPI only got a proper dev interface as of 2.6.22, not yet released. For older versions try the SCSPI driver which you can find on avr32linux.

-S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Implemented the scspi driver under Linux 2.6.18. It works, but there's some problems (userspace i/o):

1. How do I set the SPI clock rate and other settings, the function call ioctl(fd,IOCTBAUD,&speed) fails (-1) and ioctl(fd,IOCSBAUD,&speed) has no effect. Had to change constant and recompile kernel.

2. The very first byte sent using write(fd,buff,size) is deleted, ie buff[0] is never transmitted. Why?

Thanks in advance.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The missing byte is OK now, the problem suddenly disappeared. At the same time the STK1000 LCD boot splash screen is back after being missing for a while.

Maybe the SPI master unit was not initialized correctly..