Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: SPI when using Linux
PostPosted: Wed Jul 16, 2008 3:06 pm 
Offline

Joined: Wed Jul 16, 2008 2:57 pm
Posts: 3
Hi

I am trying to connect a OLED display to my Olimex AT91SAM9260QU through SPI. Currently it is running linux 2.6.23.

After reading the AT91SAM9260QU datasheet I understand how to configure and use SPI when not running any OS, but how do I do this in Linux? Do I have to write my own kernel module?

I have no SPI devices in /dev/ and no files for SPI in /sys/ or any where. Do I need a newer kernel?

One other thing I am wondering about is where I can find the necessary header files for registers and bit defines etc?

/Potetkok


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 17, 2008 9:22 am 
Offline

Joined: Wed Jul 09, 2008 10:13 am
Posts: 9
Location: neustadtgödens
Hi

I have the same problem...

My first approach was to make spi nodes in /dev
mknod /dev/spi0 c 153 0
mknod /dev/spi1 c 153 1
...
You need to have the SPI legacy driver being compiled into the kernel.

Now you can use the usual open, close, read, write functions.
But I am not abled to switch the SPI master clock.
Thus I invoking iomap to map physical memory to virtual memory space and then I set the SPI Clock e.g to 1MHz...

But I think it is dirty coding style doing it this way, but it works.
On the other hand I do not know which header to use for coding my own spi device driver with DMA tranfer and interrupt.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 17, 2008 9:41 am 
Offline

Joined: Wed Jul 16, 2008 2:57 pm
Posts: 3
Thank you for the answer piwi.

How may I check if my kernel is compiled with the SPI legacy driver? I dont have the kernel source or menuconfig settings.

Does anyone have a link to a website where I can see how to compile a custom kernel to my AT91SAM9260? What settings should be activated in the menuconfig etc.

Can I just switch my kernel to an other with out affecting the boot up. Or do I need to build new bootstrap binary or U-boot or something also?

/potetkok


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 17, 2008 10:15 am 
Offline

Joined: Wed Jul 09, 2008 10:13 am
Posts: 9
Location: neustadtgödens
log in on your prompt and type:

dmesg | grep SPI or # dmesg | grep spi

The result should be somethings like this:
AT91 SPI driver loaded

Otherwise you have to download the kernel sources and compile the kernel yourself.
Maybe the kernel sources are attached to your development board package.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 17, 2008 11:16 am 
Offline

Joined: Wed Jul 16, 2008 2:57 pm
Posts: 3
Okay thank you.

Did a grep after spi/SPI in dmesg but no luck.

So I probably need to find the kernel source and compile a new version with SPI enabled.

Is there a way to make a defconfig file (for further editing) from the current kernel without having the kernel source? Because Im a little bit unsure of what every setting should be.

Maybe I can try to find a default config file for the Olimex Sam9-l9260 some where...

/potetkok


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 21, 2008 7:50 am 
Offline

Joined: Wed Jul 09, 2008 10:13 am
Posts: 9
Location: neustadtgödens
Yes, you have to look for a default config from your eval. board distributor otherwise it will be a big time effort to compile a kernel.
Afterwards you must check the option /Device Driver/Character Devices SPI driver.
I think that it...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: