Abandoned post by Unregistered user.

I need to control 5 SPI devices using Raspberry Pi 3 and Windows 10 IoT core. But, as we know, there are only 2 SPI Chip Selects available. Is there any way that I can use the GPIO of the Raspberry Pi 3 as Chip Selects in Windows IoT 10 core?

I have a legacy code in C#, so I need to stick to Visual studio.

1 Answer 1


Not sure if you figured this out already, but one way to do this, would be to leave one of the chip selects floating and then wrap that SPIDevice so that its communications all reference GPIOs instead.

For instance:

class ExtendedSPIDevice { 
      //I save the open instance for reuse
      SpiDevice floatingDev;
      int gpioSelect;

      //I personally would initialize an SpiDevice from a manager, but you
      // could easily store the parameters and call initialize SpiDevice on 
      // each call. 
      ExtendedSPIDevice( SpiDevice initializedDev, int selectPin) {
             floatingDev = initializedDev;
             gpioSelect = selectPin;

      void Write( byte[] msg ) {
           GpioController gpio = GpioController.GetDefault();

           using(GpioPin pin = gpio.OpenPin(gpioSelect)) {
                //Pull the select Pin low

                //Write.  Clock and Data will still be present
                floatingDev.Write( msg );

                //Unselect the Chip Line

There is a some backend here, obviously, to manage the instances. What I wrote is the most basic solution for triggering chip selects. For another solution, if your I2C bus has room, you could use an I2C Selection IC instead of losing GPIOs on a 1-to-1 basis. Of course there is an increased latency with that approach and you will need to make sure to synchronously wait on the I2C line to transmit before sending an SPIwrite. The GPIO approach, however, is pretty much bit-banging, so that should only incur the latency of flipping the on/off registers on the PI itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.