Skip to content

LIS2DH SPI Support #22348

@theBASTI0N

Description

@theBASTI0N

The LIS2DH works well with I2C devices such as the Thingy52, however when testing with a Ruuvitag which has the the sensor on the SPI bus readings are wrong.

The driver looks like it doesn't not configure the SPI bus correctly as it missues the CS controller and CS pin configurations. An example of the correct configuration type can be found for the lis2ds12 driver.

Steps to reproduce the behavior:

  1. git clone https://github.com/theBASTI0N/zephyr-ruuvi.git /boards/arm/nrf52_ruuvi
  2. cd ~/xephyrproject/zephyr/
  3. west build -b nrf52_ruuvi samples/sensor/lis2dh
  4. See readings, I used:
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_UART_CONSOLE=n

There is no error in stating the device cannot be found, however the reading are wrong.

The output is:

SEGGER J-Link V6.60f - Real time terminal output
J-Link OB-SAM3U128-V2-NordicSemi compiled Jan 7 2019 14:07:15 V1.0, SN=682061953
Process: JLinkExe
*** Booting Zephyr OS build zephyr-v2.1.0-1478-g702ebb321225 ***
Polling at 0.5 Hz
#1 @ 12600 ms: x -0.009576 , y -0.009576 , z -0.009576
#2 @ 13901 ms: x -0.009576 , y -0.009576 , z -0.009576
#3 @ 15202 ms: x -0.009576 , y -0.009576 , z -0.009576
#4 @ 16503 ms: x -0.009576 , y -0.009576 , z -0.009576
#5 @ 17804 ms: x -0.009576 , y -0.009576 , z -0.009576
#6 @ 19106 ms: x -0.009576 , y -0.009576 , z -0.009576
#7 @ 20407 ms: x -0.009576 , y -0.009576 , z -0.009576
#8 @ 21708 ms: x -0.009576 , y -0.009576 , z -0.009576
#9 @ 23009 ms: x -0.009576 , y -0.009576 , z -0.009576
#10 @ 24310 ms: x -0.009576 , y -0.009576 , z -0.009576

The makes using the lis2dh12 on the ruuvitag almost impossible.

Environment

  • OS:Debian 10
  • Toolchain Zephyr SDK
  • Version 2.1.99

Metadata

Metadata

Assignees

Labels

area: SensorsSensorsbugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions