I’m using Torizon on my Colibri iMX8X module and have the Torizon extension installed in VSCode. I’m writing a .NET program using System.Devices.GPIO to interface to the I2C. I have iMX8X ball names “CSI_EN” and “CSI_RESET” configured for I2C in the device tree.
How can I determine the BusID so I can interface using System.Devices.GPIO?
Could you confirm that you are using the “Colibri iMX8QXP”?
In order to identify which Bus are you currently using, a good approach is to verify the device response through the “i2cdetect” tool, on the available i2c buses configured for the system.
You can check details for its usage here -
I2C (Linux) | Toradex Developer Center
In resume, you can list the I2C buses in the board by the following command:
Additionally you can use “i2cdetect -y -r bus_number” to scan the i2c devices on each I2C bus, as shown in the I2C tools -
I2C (Linux) | Toradex Developer Center .
Check which bus corresponds to the I2C bus you are using with the alternate function for pins CSI_EN (X1 pin 37) and CSI_RESET (X1 pin 29).
Now, about the coding for the I2C usage on dotNet.
Please check the dotnet/iot interfaces for this kind of usage.
This file has been truncated.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/// The connection settings of a device on an I2C bus.
public sealed class I2cConnectionSettings
/// Initializes a new instance of the <see cref="I2cConnectionSettings"/> class.
/// <param name="busId">The bus ID the I2C device is connected to.</param>
/// <param name="deviceAddress">The bus address of the I2C device.</param>
public I2cConnectionSettings(int busId, int deviceAddress)
You can see an example for the setup of an MPU9250 as I2C device here:
Try that and let me know if it worked
Have you tried André’s suggestions yet? Did this help clear things up or are there still questions/issues you’re having with I2C?
Any updates on this topic,
@CEK? Long time no see.