none
How to use the SPI bus in a KMDF driver RRS feed

  • Question

  • I want to create a touch screen driver for Windows 10 IoT using SPI.

    Does anyone knows how the SPI bus can be used inside of a KMDF driver (I found several posts for I2C, mentioning that it is easy to do the same for SPI).

    But I couldn't find any information about how to actually use it.

    The AcpiGenFx tool seems also not have an option for SPI, there is a command for "AddI2CSerialBus" but nothing for SPI?

    Maybe someone knows a good starting point, I couldn't find any information in MSDN or any other forum.

    Thanks

    Wednesday, February 24, 2016 10:12 AM

Answers

  • You are right that SPI is a gap and should be added to the sample. I will pass that feedback along.

    For now, let us try to get you unblocked on VHF. To start with, can you please confirm that you have installed vhf.sys as the lower filter driver. You are right that currently VHF is only supported for KMDF drivers; we do plan to add it for UMDF drivers in future.

    Thanks,

    Vivek  

    Wednesday, March 2, 2016 4:54 AM

All replies

  • SPI and I2C are covered by the Simple Peripheral Bus (SPB) KMDF class libraries, documented here. Have you looked at the SPB samples in the WDK? Also, take a look at sample Pofx\PEP for describing SPB in ACPI. This video walks through a lot of it

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Wednesday, February 24, 2016 9:29 PM
    Moderator
  • Thanks a lot for your answer.
    Unfortunately I already had a look in the documentation for the SPB.
    But as mentioned I couldn't find anything for SPI (its the same as in the linked video), SPI is always mentioned in the same way as I2C, but at the end no information how to actually use it.

    I want to create a touch screen driver for Windows 10 IoT using a SPI touch controller.
    I can talk to the device in a C# UWP App in user mode by using the "Windows.Devices.Spi" namespace.
    I started using the gpiokmdfdemo sample:

    So I'm able to use the GPIO's and probabyl also I2C (not tested) in kernel mode, I also wanted to use the ASL (ACPIGenFx) tools to create the ACPI data. But thats the same no info for SPI. I would be able to create the ACPI data for the GPIOs and also I2C and much more but not for SPI.

    I would also be statisfied by a VHF driver 
    which is fed with the touch data my app could read in the background (very bad solution, but an option).
    But also this is not working, as soon as I call the "vhfCreate" function in a KmdF driver I get the error in trace view:
    VHF: IOCTL_HID_VHF_CREATE_DEVICE failed 0xc0000010(STATUS_INVALID_DEVICE_REQUEST)
    I'm using only the basics from the link above.
    I wanted to test this with a UMDF2 driver, also no luck, compile error: "not yet supported in user mode".

    So seems I will have to switch back to Linux where this device works without any issues, I was really excited by the possibility to introduce Windows 10 IoT in my company, but seems this is not going to happen.




    Saturday, February 27, 2016 8:41 PM
  • You are right that SPI is a gap and should be added to the sample. I will pass that feedback along.

    For now, let us try to get you unblocked on VHF. To start with, can you please confirm that you have installed vhf.sys as the lower filter driver. You are right that currently VHF is only supported for KMDF drivers; we do plan to add it for UMDF drivers in future.

    Thanks,

    Vivek  

    Wednesday, March 2, 2016 4:54 AM
  • Sorry for the delayed answer, unfortunately I’m not a kernel driver expert (I used to work on kernel drivers around 10 years ago) and so also sorry for the maybe stupid question, but how can I make sure that I loaded the vhf.sys?

    I started with the default “Kernel Mode Driver” template in VisualStudio 2015, and added the changes from the VHF tutorial.

    I used the description form this small tutorial and added:HKR,,"LowerFilters",0x00010000,"vhf" 

    To my add reg section in the inf file. As mentioned the call to vhfCreate fails with log message: VHF: VhfCreate Exit: 0xc0000010(STATUS_INVALID_DEVICE_REQUEST)

    Thanks for your help!

    Monday, March 14, 2016 4:03 PM