Hello CircuitDojo Community,
Is there any developer here working with nRF9160 and STMicro’s IIS2DH accelerometer? This sensor not to be confused with STMicro’s LIS2DH accelerometer plus gyroscope.
If yes, is there any initial configuration needed to query and see acceleration values via a polling based firmware routine? Or does this sensor provide acceleration values which can be read through simple polling using Zephyr RTOS fetch and get sensor API routines?
Working from a start point of Nordic Semi sdk-nrf, running their
[west_workspace]/zephyr/samples/sensor/lis2dh sample app I am able to see sane XYZ acceleration values from the LIS2DH on the Sparkfun Thing Plus nRF9160 board. After this test with just the devlopement board and just a sample Zephyr app, I physically connect an STEVAL-MKI168V1 breakout board. I wire it for a peripheral I2C address of 0×19, so as to avoid colliding with Sparkfun Thing Plus 0×18 assigned to the LIS sensor. At this point I can still read sane accelerations from the LIS2DH.
On the code side, I’ve ported or borrowed key lines from the lis2dh sample code, into a small Zephyr project which uses the same Nordic sdk-nrf v1.6.1. I’m able to build my app and still get readings from LIS2DH. For this to work I needed to add a couple stanzas to CMakeLists.txt, and prj.conf to inform cmake where to find the driver code which the sample app calls. I add lines both for STMicro’s LIS2DH and IIS2DH driver codes. (These codes located in [west_workspace]/modules/hal/st/sensor/stmemsc/)
Using Zephyr’s ‘fetch’, ‘get’, ‘attr_set’, ‘attr_get’ routines I am able to quickly test out driver calls which work for the LIS2DH on the now connected IIS2DH. While I am able to set and read back output data rate for the IIS2DH, acceleration readings always come back all zero. Hence my question, is there some initial configuration the IIS2DH needs in order to give readings?
This does not seem to be the case for the LIS2DH sensor. I’ve applied the same one / few configurations to IIS2DH which are present in Zephyr 2.6.0’s lis2dh sample app.
Not finding any obvious instructions to this effect in STMicro’s iis2dh.pdf datasheet. Also not finding any example projects or code on-line for this sensor.
Can share further wiring details, project URL or other details. On this question any pointers and help appreciated. Thank you!