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  [ 5 posts ] 
Author Message
 Post subject: SPI driver
PostPosted: Thu Mar 04, 2010 7:16 pm 
Offline

Joined: Wed Feb 24, 2010 12:36 pm
Posts: 3
I don't know how to use the SPI driver, does any one have example under visual studio?
Under C# is correct the use of:

[DllImport("at91sam9263ek_spi.dll", EntryPoint="CreateFile", SetLastError = true)]
private static extern IntPtr CreateFile(
String lpFileName,
UInt32 dwDesiredAccess,
UInt32 dwShareMode,
IntPtr lpSecurityAttributes,
UInt32 dwCreationDisposition,
UInt32 dwFlagsAndAttributes,
IntPtr hTemplateFile);


Top
 Profile  
 
 Post subject: Re: SPI driver
PostPosted: Fri Mar 05, 2010 10:39 am 
Offline

Joined: Wed Feb 24, 2010 12:36 pm
Posts: 3
Exploring inside the dll I found:
-----------------------------------------
Functions exported = 5
Functions exported by names = 5
Functions exported by ordinals = 0
SPI_Close
SPI_Deinit
SPI_IOControl
SPI_Init
SPI_Open
-----------------------------------------
Imports:
gpio.dll
pio_set_value
pio_get_value
pio_setup
COREDLL.dll
CEDDK.dll
-----------------------------------------

Now I have the proof that I'm trying to hook the correct dll, but the function that I was looking for doesn't exist.
So, I'll try to use SPI_Init.

[DllImport ("at91sam9263ek_spi.dll", EntryPoint="SPI_Init", SetLastError = true)]
private static extern IntPtr SPI_Init(String pContext, IntPtr lpvBusContext);


Top
 Profile  
 
 Post subject: Re: SPI driver
PostPosted: Thu Mar 11, 2010 10:33 am 
Offline

Joined: Tue Mar 31, 2009 7:22 am
Posts: 23
Seems you are using SPI driver in wrong way.

SPI driver must be loaded by Device manager of WinCE OS, instead of user mode application.

And the access to SPI driver must be through WinCE Device manager and File system.

Please understand CreateFile function is from File system and it will in turn call SPI_Open function in SPI driver.

Also SPI_Init is called by device manager when OS starts up.


Top
 Profile  
 
 Post subject: Re: SPI driver
PostPosted: Thu Mar 11, 2010 11:02 am 
Offline

Joined: Wed Feb 24, 2010 12:36 pm
Posts: 3
Yes, infact I should use the CreateFile function to Open the driver. I'm following the GPIO device driver interface in this forum to understand how is it possible to connect to a device driver.

Thanks


Top
 Profile  
 
 Post subject: Re: SPI driver
PostPosted: Tue Apr 27, 2010 6:48 am 
Offline

Joined: Fri Mar 12, 2010 6:27 am
Posts: 6
Hello,

I am also trying to access the SPI interface.

As the driver is divided in three parts, I was looking for code there:

• %_TARGETPLATROOT%\SRC\DRIVERS\SPI: this directory contains the code specific to the BSP platform board,

• %_PLATFORMROOT%\COMMON\SRC\SOC\ATMEL\AT91SAM9G45\DRIVERS\SPI: this directory contains the code specific to AT91SAM9G45 Processor.

• %_PLATFORMROOT%\COMMON\SRC\SOC\ATMEL\COMMON\DRIVERS\SPI: this directory contains the code specific to all Atmel processors.

but with Adeneo BSP installed (from http://www.at91.com/windows4sam/bin/vie ... eddedCEBSP) , I could only locate the code for SPI in last mentioned path.

Can any one tell me how can I get those missing files?

Regards,
Prasad


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

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users 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: