SPI driver

This forum is for users of Atmel's SAM Series and who are interested in using WinCE OS.

Moderator: nferre

Steva
Posts: 3
Joined: Wed Feb 24, 2010 12:36 pm

SPI driver

Thu Mar 04, 2010 7:16 pm

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);
Steva
Posts: 3
Joined: Wed Feb 24, 2010 12:36 pm

Re: SPI driver

Fri Mar 05, 2010 10:39 am

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);
guangyu.ren
Posts: 23
Joined: Tue Mar 31, 2009 7:22 am

Re: SPI driver

Thu Mar 11, 2010 10:33 am

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.
Steva
Posts: 3
Joined: Wed Feb 24, 2010 12:36 pm

Re: SPI driver

Thu Mar 11, 2010 11:02 am

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
Prasaddd
Posts: 6
Joined: Fri Mar 12, 2010 6:27 am

Re: SPI driver

Tue Apr 27, 2010 6:48 am

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 windows4sam/bin/view/Windows4SAM/WindowsEmbeddedCEBSP) , 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

Return to “WinCE”

Who is online

Users browsing this forum: No registered users and 1 guest