March-15th-2018, 10:17 AM
If I try that with a python:2 container, I get the following error when starting:
linux runtime spec devices: error gathering device information while adding custom device "/dev/i2c-1": lstat /dev/i2c-1: no such file or directory
Sorry, my mistake. Works perfect now.
March-15th-2018, 05:58 PM
netPI RTE 3 features an 8KB FRAM of type FM24CL64B from Cypress that is connected to the netPI's I2C bus. Linux instantiates this I2C bus as device named
/dev/i2c-1.
To access the FRAM in a container you have to expose this host device
/dev/i2c-1 to the container when you set up its start parameter in the Docker web UI: configure
Advanced container settings/Runtime/add device/Host path=/dev/i2c-1 -> Container Path=/dev/i2c-1.
The FRAM operates as an I2C slave device and occupies the I2C address 54hex. It shares the I2C bus with the RTC chip occupying the I2C address 51hex. Install a command line toolkit with
apt-get install i2c-tools to make some I2C tests in a shell. Using the command
i2cdetect for example outpus a scan list of all detected I2C devices. You wll get indications for devices at address 51hex and 54hex.
The FRAM's
datasheet explains the sequence of bytes to be exchange over the I2C bus for proper read and write operations. If you have installed the GNU compiler using the
apt-get install build-essential your are able to compile the example code appended. Before you start the compilation you need to install the needed I2C library on your system with
apt-get install libi2c-dev. Compile it then with
gcc -o fram_test fram_test.c and start it with
./fram_test.
„You never fail until you stop trying.“, Albert Einstein (1879 - 1955)