raspberry-sharp / raspberry-sharp-system

A .NET/Mono Library for Raspberry Pi
69 stars 49 forks source link

Unknown processor for B3? #6

Open MihaMarkic opened 7 years ago

MihaMarkic commented 7 years ago

There is no processor defined for B3, it will throw when creating I2CDriver.

spudwebb commented 7 years ago

I have a similar issue, it looks like recent kernels have changed the way the processor is reported. See content of /proc/cpuinfo below. Hardware is BCM2835 instead of BCM2709 in previous versions, so I guess some values should be added to the Processor enum list

pi@raspi:~ $ more /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

processor : 1
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

processor : 2
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

processor : 3
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

Hardware : BCM2835
Revision : a02082
Serial : 00000000a6e7f141
MihaMarkic commented 7 years ago

Yeah, for the time being I simply use the same stuff as RPI 2. It works for me though I had to manually build all raspberry nugets I use.

moelski commented 7 years ago

Hi !

I think this could be fixed by changing the "ProcessorName" Function:

        public string ProcessorName
        {
            get
            {
                // https://wiki.openwrt.org/toh/raspberry_pi_foundation/raspberry_pi
                switch (Model)
                {
                    case Model.A: return "BCM2708";
                    case Model.APlus: return "BCM2708";
                    case Model.BRev1: return "BCM2708";
                    case Model.BRev2: return "BCM2708";
                    case Model.BPlus: return "BCM2708";
                    case Model.ComputeModule: return "BCM2708";
                    case Model.B2: return "BCM2709";
                    case Model.Zero: return "BCM2708";
                    case Model.B3: return "BCM2709";  // BCM2710
                    default: return "UNKNOWN";
                }
            }
        }

Maybe there should be another addon to add the hardware type BCM2710 for the Pi 3. But it works with 2709, too.

regards Dominik

Bulinlinbu commented 7 years ago

Fixed adding "Bcm2835" in Processor.cs

JTrotta commented 7 years ago

For CM3 (Compute Model 3) also needed to modify Board.cs: `private Model LoadModel() { var firmware = Firmware; switch (firmware & 0xFFFF) { case 0x2: case 0x3: return Model.BRev1;

            case 0x4:
            case 0x5:
            case 0x6:
            case 0xd:
            case 0xe:
            case 0xf:
                return Model.BRev2;

            case 0x7:
            case 0x8:
            case 0x9:
                return Model.A;

            case 0x10:
                return Model.BPlus;

            case 0x11:
                return Model.ComputeModule;

            case 0x12:
                return Model.APlus;

            case 0x1040:
            case 0x1041:
                return Model.B2;

            case 0x0092:
            case 0x0093:
                return Model.Zero;

            case 0x2082:
                return Model.B3;

            case 0x20A0:
                return Model.ComputeModule3;`

And ` private ConnectorPinout LoadConnectorPinout() { switch (Model) { case Model.BRev1: return ConnectorPinout.Rev1;

            case Model.BRev2:
            case Model.A:
                return ConnectorPinout.Rev2;

            case Model.BPlus:
            case Model.ComputeModule:
            case Model.APlus:
            case Model.B2:
            case Model.Zero:
            case Model.B3:
            case Model.ComputeModule3:
                return ConnectorPinout.Plus;

            default:
                return ConnectorPinout.Unknown;
        }
    }`
bellum128 commented 6 years ago

Will the nuget packages be updated with a fix for this issue?

DWalton4 commented 5 years ago

Can anyone suggest an alternative package that works on recent vintage Pi's?

bfsmithATL commented 5 years ago

Hey DWalton4, check out this repo: https://github.com/JTrotta/RaspberrySharp

Maintained nicely and this guy will likely have/create an update!