FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
129 views 1 comments
by anonymous

Hi

After compiling i2c or SPI sensor modules (e.g. ina219 or accelerometer, etc.) to the kernel, is it possible to connect them to the router interface. If there is such a possibility, then how?

Reg Peter

1 Answer

0 votes
by anonymous

Hello,

The device has 7x2 connector on its PCB with the markings of the pins for SPI (CS, DO, DI, CLK) and I2C (SCL, SDA) as well as 3.8V supply and GND pins.

In the SDK, you may need to add spi-tools and i2c-tools modules, though in 7.04 firmware I found /dev/i2c-2 and /dev/spidev6.0 already present.

There also seems to be preinstalled tools for i2c interface:

root@Teltonika-TRB140:~# i2c
i2cdetect    i2cdump      i2cget       i2cset       i2ctransfer

As is the case with SPI:

root@Teltonika-TRB140:~# spi-pipe -h
usage: spi-pipe options...
  options:
    -d --device=<dev>    use the given spi-dev character device.
    -s --speed=<speed>   Maximum SPI clock rate (in Hz).
    -b --blocksize=<int> transfer block size in byte.
    -n --number=<int>    number of blocks to transfer (-1 = infinite).
    -h --help            this screen.
    -v --version         display the version number.
root@Teltonika-TRB140:~# spi-config -d /dev/spidev6.0 -q
/dev/spidev6.0: mode=3, lsb=0, bits=8, speed=19200000, spiready=0

I have not tested that personally, the tools were created for developers to tinker around, interested in expanding device functionalities and use cases, to try, thus hopefully the above details will provide a good starting pont.

Best regards,

by anonymous
Hi.

Thanks for your answer - I will keep experimenting :).

Best Regards Peter