Hello, guys!
I recently started playing with nRF9160 SiP module. nRF Connect SDK is properly installed and I am able to build the code and download it properly. I also spent some time reading nRF Connect SDK tutorial. Now, I am exploring the possibilities of adding new devices that will communicate with nRF9160-DK. I started with devices whose drivers exist under
ncs/zephyr/samples/sensor/
Since I have LIS12DH evaluation board here with me, I initially tried to communicated with that sensor over I2C by using the drivers I found under
ncs/zephyr/samples/sensor/lsm303dlhc
I copied that whole folder from there to ncs/nrf/samples and renamed it to lis2dh. In order to add new I2C device on the tree, I included nrf9160_pca10090ns.overlay file with the following content:
&i2c2 { compatible = "nordic,nrf-twim"; status = "okay"; sda-pin = <30>; scl-pin = <31>; clock-frequency = <I2C_BITRATE_FAST>; lis2dh@19 { compatible = "st,lis2dh"; reg = <0x19>; label = "LIS2DH"; }; };
I also slightly modified the code inside main.c because I wanted to communicate only with the accelerometer, not with the magnetometer device. I built the project from Segger Embedded Studio, downloaded to nRF9160-DK and got the expected results - I was able to read (x, y, z) values of the accelerometer!!! Great success!
Now, I wanted to do the same thing with another I2C sensor, the one that we actually need for our current project - VL53L1X. We used VL53L1X breakout board form Sparkfun for testing. We were happy to see that under ncs/zephyr/samples/sensor/ we can find the drivers for VL53L0X device - the one that is fully compatible with VL53L1X and only differs in the measurement range.
We did the same thing like with LIS12DH sensor in order to build and download the code. Here is the content of the nrf9160_pca10090ns.overlay file:
&i2c2 { compatible = "nordic,nrf-twim"; status = "okay"; sda-pin = <30>; scl-pin = <31>; vl53l0x@29 { compatible = "st,vl53l0x"; reg = <0x29>; label = "VL53L0X"; }; };
However, when we run the code we get the following message instead of distance values: "Could not get VL53L0X device"
This would mean that we failed to bind device with
device_get_binding("VL53L0X");
This could be, to the best of my understanding, if we don't properly read the ID of the sensor through I2C.
Do you guys have any idea about what we are missing here?
we supply VL53L1X breakout board board with 3.3V and I removed 3.3V pull-up resistors from the board exposing I2C lines to 1.8V interface from nRF9160-DK board. According to VL53L1X datasheet that should be OK because IOVDD should typically be 1.8V.
Thank you very much for your time and efforts! It is really appreciated.
Sincerely,
Bojan.