SCSInet
Posts: 1
Joined: Mon Jan 16, 2017 5:00 pm

SPI interface unused pins used as GPIO

Mon Jan 16, 2017 5:07 pm

Can anyone tell me if it is possible to use unused SPI interface pins for normal GPIO?

I am using the SPI0 interface to communicate with an MCP3008 ADC which is using MOSI, MISO, SCLK, and CS0 on interface SPI0 of a Pi 2. The environment is 10 IOT and the application language is C#.

Can I use pin CS1 for general GPIO without disrupting normal communication between the Pi and the ADC?

Thanks in advance.

gnux8
Posts: 11
Joined: Fri Aug 14, 2015 9:10 am

Re: SPI interface unused pins used as GPIO

Tue Jan 17, 2017 3:54 pm

Yes could be very interesting also im using only 2 pin for max7219 and i would like to use the remain one for normal gpio ... i share my code ...

Code: Select all

private async Task InitSpi()
        {
            try
            {
                var settings = new SpiConnectionSettings((int)chipSelect);
                settings.ClockFrequency = 10000000;
                settings.Mode = SpiMode.Mode0;
                settings.SharingMode = SpiSharingMode.Shared;

                string spiAqs = SpiDevice.GetDeviceSelector(SPIControllerName);       /* Find the selector string for the SPI bus controller          */
                var devicesInfo = await DeviceInformation.FindAllAsync(spiAqs);         /* Find the SPI bus controller device with our selector string  */
                SpiDisplay = await SpiDevice.FromIdAsync(devicesInfo[0].Id, settings);  /* Create an SpiDevice with our bus controller and SPI settings */
            }
            /* If initialization fails, display the exception and stop running */
            catch (Exception ex)
            {
                throw new Exception("SPI Initialization Failed", ex);
            }
        }
regards,
Andrea

Return to “Windows 10 for IoT”