Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple I2C Channels

Has anyone tried to use more than the single I2C channel on a Raspberry Pi with Linx ?

It's possible to set up several I2C channels on a Rpi (Which I've done) but the Linx toolkit is only detecting one. The documentation in the code seems to suggest that more than one is possible

thanks

0 Kudos
Message 1 of 4
(212 Views)

Linx is currently not detecting I2C ports but simply hardwired to use only that one. Supposedly because older Raspberry Pi by default only had this one. There could be a lot more done to try to autodetect what is present but that is cumbersome and very difficult to test. Also Linx is currently a little limited as it would also need to return you some way of identifying which interface index is assigned which actual interface if it would do autodetection. My idea was to add for I2C, SPI and UART rather an open function that accepts a device name so the software can decide what port to open, but that didn't quite get to a state that is really ready to put out there.

Rolf Kalbermatter
Averna BV
0 Kudos
Message 2 of 4
(196 Views)

Thanks for your reply Rolf,

I guess the option for specifying the I2C channel in code relates to Arduino and was never implemented for Rpi ?

I'll have to add a I2C expander chip to my design in that case, shame I couldn't use the Rpi capability.

Adrian

 

0 Kudos
Message 3 of 4
(183 Views)

The Linx interface is meant to be universal for all supported targets. The target specific settings are implemented in shared libraries for each individual target, which is a bit cumbersome to manage but much easier to write than trying to make it all auto configurable. And as targets like Arduino and Raspberry Pi are way to different in their actual OS interfaces and CPU architecture it would anyhow not be possible to target all with one shared library anyhow. But I think the current situation of one Arduino library for every possible Arduino board definitely could be improved. They don't all use different CPUs and the main difference is often the number of specific peripherals.

 

You could modify the liblinxdevice.so shared library that the Linx Toolkit uses to interface to the OS. The source code for it is included in the Toolkit. The difficulty is figuring out what to chance and where and then to recompile the shared library and replace the one Linx installs on the target with your own. If you are not afraid from logging into your Pi through an SSH tool, and then invoking some gcc commands on the command line, it can be done. 

Rolf Kalbermatter
Averna BV
0 Kudos
Message 4 of 4
(174 Views)