I bought a tiny board on Aliexpress from HolyIOT. It comes with an nRF52832 and an LIS2DH12 accelerometer. The silkscreen on the board says HOLYIOT-21011-v1.0.
This schematic is not from the exact same board but is nearly identical. Sorry for the bad quality, it's the best I could find.
My goal is to obtain readings from the LIS2DH12 accelerometer. I tried using SPI first, but I had no luck.
Then, I tried with I2C since I'm more familiar with it. I paid attention to the accelerometer pins to enable the power supply, set it to I2C mode, and configure SA0.
With both SPI and I2C, I tried using Zephyr's official driver for this sensor, but I couldn't get it to work, apparently due to errors while reading the chip ID (WHO_AM_I register).
So, I then tried using the I2C shell to check this register manually. Here is the capture:
As you can see, the I2C scanner found the correct address of the sensor (0x19). I was also able to query the WHO_AM_I (0x0F) register, and the sensor responded correctly with 0x33, as stated in the datasheet.
At that point, I stopped trying with the sensor driver and decided to use the bare I2C functions instead. Here is an example:
Here is another try:
This is part of the pinctrl:
And this is from the DTS file (with the driver section commented out since I'm no longer using it):
So, I concluded that the issue seems to be in the communication between the devices rather than in the driver itself. That's why I'm trying to focus on that. The problem is that I can't understand why it works through the shell but not with the bare I2C functions, which are almost identical to the ones used in the shell's source code.
Thanks in advance.