I2C2 on 20260N

                    var sda = GpioController.GetDefault().OpenPin(SC20260.GpioPin.PB9);
                    var scl = GpioController.GetDefault().OpenPin(SC20260.GpioPin.PB8);

                    //var controllers = I2cController.FromName(SC20260.I2cBus.Software, sda, scl);

                    var controllers = I2cController.FromName(SC20260.I2cBus.I2c2, sda, scl);

Does this work ok?

If you want to use a hardware I2C, like I2C2, you don’t need to add the SCL/SDA pins to the constructor. Just the first argument is enough.

The pins only need to be specifically defined if you want to use software I2C, which is much slower and resource heavy than using hardware I2C.

There is no I2C2 hardware on SCM20260. When I try Software it give this error


1 Like