Open eoinward opened 3 years ago
That's interesting... Thanks @eoinward ... I'll add a note to the workshop... Thanks!
Done! I've added a note there, and also to my blog post here... https://bit.ly/dotnet5pi
Interestingly, this is supposed to be fixed... https://github.com/dotnet/iot/issues/1329
I just double checked my Pi version, I had used an older Pi (I have a 2 and 3):
cat /proc/device-tree/model
Raspberry Pi 2 Model B Rev 1.1
Probably not many people using a Pi 2 anymore, not sure if there is much value in the note. Apologies with the miss information.
Can you do me a favout @eoinward and open up your csproj file and check which version of the GPIO package you're using please?
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Device.Gpio" Version="1.3.0" />
</ItemGroup>
</Project>
Interesting then...
It clearly isn't fixed here then eh... https://github.com/dotnet/iot/issues/1329.
Can you run the following commands one by one on your pi and let me know what you get back?
pinout
cat /proc/cpuinfo
cat /proc/device-tree/model
pi@raspberrypi:~ $ cat /proc/cpuinfo processor : 0 model name : ARMv7 Processor rev 5 (v7l) BogoMIPS : 38.40 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc07 CPU revision : 5
processor : 1 model name : ARMv7 Processor rev 5 (v7l) BogoMIPS : 38.40 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc07 CPU revision : 5
processor : 2 model name : ARMv7 Processor rev 5 (v7l) BogoMIPS : 38.40 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc07 CPU revision : 5
processor : 3 model name : ARMv7 Processor rev 5 (v7l) BogoMIPS : 38.40 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc07 CPU revision : 5
Hardware : BCM2835 Revision : a21041 Serial : 000000008d6899d0 Model : Raspberry Pi 2 Model B Rev 1.1
Raspberry Pi 2 Model B Rev 1.1
Oooo! you're running a Pi2 not a Pi3 it reckons then!
Yes that is it fix on Pi3 still an issue on Pi2
that said using var driverType = assembly.GetType("System.Device.Gpio.Drivers.RaspberryPi3LinuxDriver"); iss working fine on my Pi2
Might see if I can get a PR in to fix in in Pi2, should be a bit of fun: https://github.com/dotnet/iot/issues/1270
Yeah... The issue will be that your BCM id isn't in the https://github.com/krwq/iot/blob/466fb50222726c318909ef0b0ee763056cc6cfef/src/System.Device.Gpio/System/Device/Gpio/RaspberryBoardInfo.cs file...
What did the pinout command give you? Feel free to upload a PNG...
Like you said looks like there are 2 Model 2 boards but only one is listed here:
Your BCM id is actually in the https://github.com/dotnet/iot/blob/main/src/System.Device.Gpio/System/Device/Gpio/RaspberryBoardInfo.cs file...
0x1041
This is the file that determines which board you have.,..
So there must be something else wrong...
I wonder... Is it worthwhile just checking trying using the nightly package maybe?
https://github.com/dotnet/iot#net-cli
Just incase, for some reason, this hasn't made it into the nuget package... It can't see why it wouldn't have done tho...
Currently on your Garage course and working "On the Flash LEDs": https://github.com/pjgpetecodes/rpirobot/blob/main/workshop/06-flash-led.md
I am getting an error using a PI 2
Unhandled exception. System.PlatformNotSupportedException: This driver is generic so it can not perform conversions between pin numbering schemes. at System.Device.Gpio.Drivers.SysFsDriver.ConvertPinNumberToLogicalNumberingScheme(Int32 pinNumber) at System.Device.Gpio.GpioController.GetLogicalPinNumber(Int32 pinNumber) at System.Device.Gpio.GpioController.OpenPinCore(Int32 pinNumber) at System.Device.Gpio.GpioController.OpenPin(Int32 pinNumber) at System.Device.Gpio.GpioController.OpenPin(Int32 pinNumber, PinMode mode) at robot_firmware.Program.Main(String[] args) in /home/pi/share/robot_firmware/Program.cs:line 19
You can force the System.Device.Gpio.Drivers.RaspberryPi3LinuxDriver rather than it falling through to the generic
Maybe just a note for future users if they are still on an old Pi they could just add to all the code: Solution form here: https://www.gitmemory.com/issue/dotnet/iot/1329/735402962