raspberry-sharp/raspberry-sharp-io

I2C and RPi3

JTrotta opened this issue · 1 comments

I2C address seem to be different from Pi2 and Pi3.
To make it work with Pi3 I changed these lines in Raspberry.IO.InterIntegratedCircuit.I2cDriver:
` private static uint GetProcessorBscAddress(Processor processor)
{
switch (processor)
{
case Processor.Bcm2708:
return Interop.BCM2835_BSC1_BASE;

            case Processor.Bcm2709:
            case Processor.BCM2835: // <- added this one FIX per RB3
                return Interop.BCM2836_BSC1_BASE;
            
            default:
                throw new ArgumentOutOfRangeException("processor");
        }
    }`
    private static uint GetProcessorGpioAddress(Processor processor)
    {
        switch (processor)
        {
            case Processor.Bcm2708:
                return Interop.BCM2835_GPIO_BASE;

            case Processor.Bcm2709:
            case Processor.BCM2835: // <- added this one  FIX per RB3
                return Interop.BCM2836_GPIO_BASE;

            default:
                throw new ArgumentOutOfRangeException("processor");
        }
    }

Now I can connect to I2C but during reading operations I'm receiving this error:

Execute error Read Read operation failed with BCM2835_I2C_REASON_ERROR_DATA status, missing 1 bytes