question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GPIO pin 12 on RPi 4 doesn't pull-up

See original GitHub issue

Describe the bug

When attempting to use pin 12 in InputPullUp PinMode, the pin does not pull up. (This has been tested with multimeter.)

Steps to reproduce Just use the following code to configure the pin:

 GpioController controller = new GpioController(PinNumberingScheme.Logical);
            Console.WriteLine("Starting button test");

            if (mode == 1)
            {
                controller.OpenPin(buttonNumber, PinMode.InputPullUp);
            }

            if (mode == 2)
            {
                controller.OpenPin(buttonNumber, PinMode.InputPullDown);
            }

            while (true)
            {
                if (controller.Read(buttonNumber) == PinValue.Low)
                {
                    Console.WriteLine("Button pressed");
                    Thread.Sleep(TimeSpan.FromSeconds(1));
                }
            }

Expected behavior The pin (12) should be pulled up to 3.3V and when connected to the button, the code above should work.

Actual behavior The pin (12) stays at low.

Versions used

Add following information: Versions used SDK: 3.1.400-preview-015151 [C:\Program Files\dotnet\sdk] Version of System.Device.Gpio package: 1.0.0

NOTE: This code & setup works on RPi 3 B+. I have tested the pin itself by toggling high & low using C# code and it functions as expected. When using python to pull-up the pin it works as expected, that is why I am assuming its something to do with the System.Device.Gpio package.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
pgrawehrcommented, Jun 15, 2020

This is probably a coincidence. Package version 1.0.0 just doesn’t properly handle pullups for the Pi4 (since that requires a different low-level operation than on the Pi3, which was not documented properly at the time 1.0 was released). So that might just work, depending on the startup settings. It will fail when you try to change it (i.e. set it to pulldown) on any pin. Please try again with the prerelease version, as described in the readme here: https://github.com/dotnet/iot/blob/master/README.md

0reactions
krwqcommented, Sep 15, 2020

Note, there is an already existing issue for detection where some of the mentioned stuff doesn’t work: https://github.com/dotnet/iot/issues/1145

Read more comments on GitHub >

github_iconTop Results From Across the Web

GPIO pull ups not working on Pi4 - Raspberry Pi Forums
I'm upgrading an old model B to a Pi4 used in an alarm system with numerous GPIO input and output pins. However, I...
Read more >
Which Rpi Pins are pulled up or down during startup?
I tried to validate that in my RPi 4 Model B, I tested GPIO Pins 0 to 8 when the RPi boots up...
Read more >
Pi 4 and Gpio Issues - Hardware
Another thing to note is that not all GPIOs have internal pull ups (I don't believe), so on some you could get inconsistent...
Read more >
Using PullUp and PullDown Resistors on the Raspberry Pi
We need a way to force the pin to LOW (also known as "pull down") when the circuit is open (or to HIGH...
Read more >
Raspberry gPIo - SparkFun Learn
In this tutorial we'll show two different approaches to reading and driving the Raspberry Pi's GPIO pins: python and C. Here's a quick...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found