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.

GpioController is not correctly identifying Raspberry Pi with Revision c03112

See original GitHub issue

I would like to use Dht11 module on Raspberry PI 4 Revision 1.2 (Model C03112).

Steps to reproduce

using (Dht11 dht = new Dht11(17))
{
    var temperature = dht.Temperature;
}

Expected behavior

Accessing dht.Temperature must work without getting an exception. Used PI model supports InputPulUp pin mode.

Actual behavior

Exception occurs when accessing dht.Temperature.

An unhandled exception of type 'System.InvalidOperationException' occurred in System.Device.Gpio.dll: 'Pin 17 does not support mode InputPullUp.'

Further analysis

In Issue 1145 there is a workaround described:

GpioDriver driver = new RaspberryPi3Driver();
GpioController controller = new GpioController(PinNumberingScheme.Logical, driver);

Unfortunately this also does not help because PI model could not be detected and RaspberryPi3Driver() cannot be initialized.

An unhandled exception of type 'System.PlatformNotSupportedException' occurred in System.Device.Gpio.dll: 'Not a supported Raspberry Pi type: Unknown'
at System.Device.Gpio.Drivers.RaspberryPi3Driver..ctor() at MyConsoleApp.Program.ReadFromDHT11()

The actual reason of that behavior is, that enum Model in System.Device.Gpio.RaspberryBoardInfo does not contain C03112 value.

Model C03112 is officially listed on Raspberry.org, model C03114 seems also not supported.

Versions used

Raspberry:

/proc/cpuinfo: Hardware: BCM2711 Revision: c03112 Serial : 10000000683cf6ea Model : Raspberry Pi 4 Model B Rev 1.2

OS: Linux 5.4.0-1022-raspi #25-Ubuntu SMP PREEMPT Thu Oct 15 14:22:53 UTC 2020

Dotnet:

.NET Core SDK (reflecting any global.json): Version: 3.1.403 Commit: 9e895200cd

Runtime Environment: OS Name: ubuntu OS Version: 20.04 OS Platform: Linux RID: ubuntu.20.04-arm Base Path: /usr/bin/dotnet/sdk/3.1.403/

Host (useful for support): Version: 3.1.9 Commit: 774fc3d6a9

.NET Core SDKs installed: 3.1.403 [/usr/bin/dotnet/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.9 [/usr/bin/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.9 [/usr/bin/dotnet/shared/Microsoft.NETCore.App]

Libraries:

Iot.Device.Bindings: 1.1.0-prerelease.20555.1 System.Device.Gpio: Version="1.1.0-prerelease.20555.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pgrawehrcommented, Dec 18, 2020

@krwq: There’s a link in the OP above. The page on RaspberryPi.org seems to be current, as it includes both the Rasppi 4B 8GB and the Raspi 400.

1reaction
Ellerbachcommented, Nov 9, 2020

I see. Seems that this line is causing the issue:https://github.com/dotnet/iot/blob/de328cacc0dd03d539d6508c6d6239383c44af1b/src/devices/Dhtxx/DhtBase.cs#L165. I’ve seen this issue on few other boards as well which doesn’t support input pull up. Best is for sure to change this to a normal Input (supported everywhere), the pull up has to be external (which is the case 99.9999% of the time with those sensors). So if you pull the code from the repo and adjust this line, it should work. The time we make a fix and push it. Would be perfect if you can tell us if that fixed the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unknown Raspberry Pi 4B revision (v. 1.2 / c03112)?
Hey, last week I finally got my new Raspberry Pi 4B (4 GB version). I have noticed that it has a revision number...
Read more >
Raspberry Pi hardware - Raspberry Pi Documentation
The official documentation for Raspberry Pi computers and microcontrollers.
Read more >
Checking Raspberry Pi Revision Number & Board Version
Find the Raspberry Pi Revision Number and identify what Raspberry Pi model you have using these easy techniques.
Read more >
GPIO not working on Raspberry PI 4 4GB
After performing the upgrade on my RPi 4, everything seems to work fine - on RPi OS. As you'll learn after reading the...
Read more >
How to Check if Your Raspberry Pi 4 Model B is Rev1.2?
You can learn how to decode Raspberry Pi revision codes here. If you have a Rev1. 1 board of 2GB, it will shows...
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