Windows driver sample for SPI device

I am looking for a sample code in WDK (8.1 and 10) for an SPI device. I see the samples on I2C and on GPIO. Somehow, I do not see anything on SPI. I would appreciate any pointer. Thanks

The SPB client driver model is such that you don’t really care if the device
is connected via I2C or SPI, they’re both just presented as a serial
connection resource (though you can know the specific bus if necessary).

Follow the I2C example and you should be all good. SpbTest is also a great
place to start for educational purposes, it’s a generic SPB client driver
that will communicate with any serial device connected via I2C or SPI. As
you’ll see from the code it’s all done in a generic way, the underlying bus
doesn’t actually matter.

-scott
OSR
@OSRDrivers

wrote in message news:xxxxx@ntdev…

I am looking for a sample code in WDK (8.1 and 10) for an SPI device. I see
the samples on I2C and on GPIO. Somehow, I do not see anything on SPI. I
would appreciate any pointer. Thanks

Scott,

Thanks so much for the information. I will look at spbtest very carefully. I compiled spbtest example, and it is a kernel mode driver. I see a few I2C examples in user-mode. Since I just start it, I would like to ask another question. As you said, SPB client driver model is generic and modification may be need to connection resource (I2C or SPI), can I write a user-mode SPI driver that is similar to user-mode accelerometer sample? Thanks so much for your help.

Dali

There should be no problem doing this in user mode. I briefly looked at the
sample and it is choosing to restrict itself I2C when parsing its resources.
I don’t see any other processing though that would be specific to an I2C
attached device versus SPI, it’s all abstracted through the SPB I/O
interface:

https://msdn.microsoft.com/en-us/library/windows/hardware/hh698227(v=vs.85).aspx

-scott
OSR
@OSRDrivers

wrote in message news:xxxxx@ntdev…

Scott,

Thanks so much for the information. I will look at spbtest very carefully. I
compiled spbtest example, and it is a kernel mode driver. I see a few I2C
examples in user-mode. Since I just start it, I would like to ask another
question. As you said, SPB client driver model is generic and modification
may be need to connection resource (I2C or SPI), can I write a user-mode SPI
driver that is similar to user-mode accelerometer sample? Thanks so much for
your help.

Dali