SwampieUK
Posts: 6
Joined: Tue Jun 02, 2015 2:35 pm

Can header pin 11 be used as GPIO17 in Windows 10 IoT?

Thu Jun 04, 2015 12:54 pm

I originally asked this question on StackExchange (http://raspberrypi.stackexchange.com/qu ... ows-10-iot) but didn't get any response there. I'm hoping to have more success here :D

Thanks to the Raspberry Pi birthday event I have an Energenie RF transmitter 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:

Code: Select all

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:

Code: Select all

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/ ... gsRPi2.htm, Microsoft says physical pin 11 is SPI1 CS0.

Image

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?

I have managed to get the Energenie board working under Windows 10 IoT, but only by hotwiring it with jumpers - using GPIO18 in code, and connecting GPIO18 to the GPIO17 socket of the Energenie board, but ideally I'd like to avoid that and just get GPIO17 working as expected. Any ideas?

markrad_msft
Posts: 58
Joined: Thu May 07, 2015 7:46 pm

Re: Can header pin 11 be used as GPIO17 in Windows 10 IoT?

Fri Jun 05, 2015 9:14 pm

To the best of my knowledge it is assigned as SPI1 CS0 permanently. I think this is a restriction enforced by the hardware but I may be wrong.
Mark Radbourne | Microsoft | Windows 10 IoT Core Insider Preview Support | This posting is provided 'as is' with no warranties and confers no rights.

User avatar
panik
Posts: 369
Joined: Fri Sep 23, 2011 12:29 pm
Location: Netherlands

Re: Can header pin 11 be used as GPIO17 in Windows 10 IoT?

Sat Jun 06, 2015 1:30 pm

markrad_msft wrote:To the best of my knowledge it is assigned as SPI1 CS0 permanently. I think this is a restriction enforced by the hardware but I may be wrong.
SPI1 CS0 is one of 5 ALT functions of that pin. If there's a restriction (not sure) it's enforced by the OS, not by the hardware.

All ALT functions: http://elinux.org/RPi_BCM2835_GPIOs
Microcontroller addon boards and software for Raspberry Pi A+/B+/Pi2:
- ARMinARM: ARM Cortex-M3 (STM32)
- AVRPi: ATmega32U4 & ATmega328 ("Arduino")
http://www.onandoffables.com

Berndt73
Posts: 11
Joined: Tue Jun 02, 2015 11:13 am

Re: Can header pin 11 be used as GPIO17 in Windows 10 IoT?

Sat Jun 06, 2015 7:43 pm

Hi,

This doc helped me a lot to figure out the working GPIOs:
http://ms-iot.github.io/content/en-US/w ... gsRPi2.htm

BUT, it's not possible to use GPIO4 (even when the doc tells something different).

I ended up using three 74hc595 for my version of the Raspberry PI Pong C# -Version, which uses
2x7seg Leds and 7 LEDs to simulate the pong board...so I have "enough GPIOs" available...

HTH,

Berndt Hamboeck

Return to “Windows 10 for IoT”