How to set GPIOs high before sensor driver initializes?

EDIT: Sorry to be posting a lot about my LIS2DH12 problems lately, as I'm advancing somewhat while I have open support threads. Newest thread is here:  Runing LIS2DH12 on custom hardware In preparation of this thread I have hardwired the GPIOs mentioned below to VDD so they should not affect operation.

Hi,

I'm using LIS2DH I2C driver, but my hardware design is based on SPI connection (sensor supports both). Therefore I have GPIO pins controlling some of the functions like I2C address LSB and CS signal to configure I2C operation (sensor operates in I2C mode if CS is HIGH)

First of all, the VDD of LIS2DH12 is directly connected to a GPIO pin, but this is probably solved by driver parameter "supply-gpios". I assume the GPIOs defined here are set to HIGH before during driver init to turn sensor on?

So I put three GPIOs in the supply-gpios parameter;
VDD, controlling power to the sensor
CS, controlling comm. mode 
SDO, controlling I2C address LSB

All are configured to active high, expecting them to go HIGH to turn on the device, set I2C mode and set address LSB to 1 resulting in an address of 0x19.

Do know that I also try to set these GPIOs in main thread in case the driver init does not do what I want, but it seems that sensor driver inits way before I set the GPIOs anyways.

The output of RTT terminal indicates that sensor init did not go to plan:
<err> lis2dh: Failed to read chip id.
*** Booting nRF Connect SDK 3758bcbfa5cd ***
Device LIS2DH is not ready

So I guess my main problem is that I don't get the LIS2DH12 to work but I suspect it has to do with my special requirements of having to set GPIOs to a known state before the sensor driver inits or during init. Code is based on LIS2DH12 sample with addition of some GPIO.

Any thoughts on my problems are appreciated.

Parents Reply Children
No Data
Related