I have an Energenie RF transmitter add-on board which fits onto the Raspberry Pi header (for more details, see https://energenie4u.co.uk/res/pdfs/ENER314%20UM.pdf). This board allows the Raspberry Pi to control up to 4 Energenie radio controlled mains sockets. I have successfully got it working on a Raspberry Pi B running Raspbian, with a simple Python script to twiddle the 6x GPIO pins it uses. The GPIO pins it uses are:
- GPIO17 (header pin 11)
- GPIO27 (header pin 13)
- GPIO22 (header pin 15)
- GPIO23 (header pin 16)
- GPIO24 (header pin 18)
- GPIO25 (header pin 22)
I've been trying out Windows 10 IoT on Raspberry Pi 2 and I've successfully got it doing a basic flashing LED using GPIO5 (header pin 29), which proves GPIO works, and confirms the Windows GPIO API uses logical GPIO numbering rather than physical pin numbering.
I'm now trying to use the Energenie board with Windows 10 IoT and having an issue using GPIO17 (header pin 11). I use the following code to try and open a pin:
private GpioPin openPinForOutput(GpioController gpioController, int pinNumber)
{
if (gpioController == null)
{
Debug.WriteLine("GPIO Controller is null");
return null;
}
GpioPin pin = null;
GpioOpenStatus status = GpioOpenStatus.PinOpened;
bool success = gpioController.TryOpenPin(pinNumber, GpioSharingMode.Exclusive, out pin, out status);
Debug.WriteLine("GPIO pin {0} status: {1}", pinNumber, status);
return pin;
}
When I call this method for the required GPIO pins I get the following output:
GPIO pin 17 status: PinUnavailable
GPIO pin 22 status: PinOpened
GPIO pin 23 status: PinOpened
GPIO pin 27 status: PinOpened
GPIO pin 24 status: PinOpened
GPIO pin 25 status: PinOpened
I then looked further at GPIO17 (physical pin 11) and found that according to https://ms-iot.github.io/content/en-US/win10/samples/PinMappingsRPi2.htm, Microsoft says physical pin 11 is SPI1 CS0.
Is there any way to reclaim physical pin 11 as GPIO17 in Windows 10 IoT, or are we just stuck with it being permanently configured for SPI1 CS0?