Hi!
I’m new to legato and mangoh red and could use some advise.
I want to connect an external accelerometer to the i2c pins of the raspberry pi connector of a mangoh red (wp7607) .
Is there any example of how to get sensor data from the raspberry connector (i2c) to a similar file as the one used by the on-board sensors in the redSensorToCloud app (sys/bus/i2c/devices/4-xxxx)?
Where/How can I access the i2c bus of the raspberry connector i2c-lines?
Yes I have used the accelerometer on the mangoh red board with the redSensorToCloud app. But I want to explore the possibility of connecting an external accelerometer as well.
From the example GroveLedMatrixMangOH
In the ledmatrix.adef:
//replace these devices based on your module
[rw] dev/i2c-0 dev/i2c-ledmatrix
Is the device i2c-0 the i2c bus of your component?
How do I know where I can find the i2c bus of my accelerometer?
Is the device i2c-0 the i2c bus of your component?
–>yes, for your module , I think that i2c-4 is corresponding.
How do I know where I can find the i2c bus of my accelerometer?
–>Unfortunately, I also can’t find out i2c bus of my device by using i2cdetect -y -r 4 (for wp76xx) and i2cdetect -y -r 0 (for wp8548) but you can follow code what I referred to you above and using logread -f command to track whether you can send data to I2C device or not.
Hi @mastr,
I realized that I was confused about the question number 1, as you mentioned, It seems that your module has been enabled all virtual buses by kernel driver of i2c-hub (pca954x), so you can see /dev/i2c-5, /dev/i2c-6, /dev/i2c-7, /dev/i2c-8
follow schematic of mangoh red https://mangoh.io/uploaded-documents/Reference/mangOH%20Red/Hardware/Schematics/MangoRed_DV6_final.pdf you can see the raspberry pi header, the I2C lines are labeled SDA_EXP, SCL_EXP and connect to SD3, SC3 (channel 3) of TCA9546A hardware, the hardware has 4 channel 0-3 correspond to virtual buses 5-8, so if you want to access the i2c of raspberry connector, please use /dev/i2c-8.
Note : if you follow my source, please remove lines from 822 to 856 in ledmatrixUtils.c file, because your module has been enabled i2c-hub.