Skip to main content
Associate
July 15, 2025
Solved

LIS2HH12 via SPI connection XYZ axis stall at fixed value

  • July 15, 2025
  • 3 replies
  • 338 views

Hello.

I am working with the STM32U083 and LIS2HH12TR communication via SPI. 

Did the SPI settings configuration in mode 3 and build a simple project in cube ide to identify and read the accelerometer data.

The project also does the conversion in mg of the acceleration for all axis. 

When I move the axis I was expecting the values to change but there is no change as in picture below: (Debug data via uart ). 

Does anyone come out with this kind of problem ? 

Could it be sensor (accelerometer) damage, a soldering problem, or something else?

Following the terminal log:

EngHwho_0-1752574142740.png

Please support.

Thankyou

Best answer by TDK

Some options:

  • Look for code on the internet.
  • Find a colleague or someone else otherwise invested who can assist.
  • Pay someone to write it.

3 replies

TDK
Super User
July 15, 2025

Unlikely that all readings for all axes are exactly the same. Perhaps a code bug. Doesn't feel like a hardware issue.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Andrew Neil
Super User
July 15, 2025

@EngHwho wrote:

Could it be sensor (accelerometer) damage, a soldering problem, or something else?

Thankyou


As @TDK , I'd guess most likely a coding issue.

Have you tried logging just the raw data direct from the accelerometer?

Have you looked at the data on the bus with an analyser?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
EngHwhoAuthor
Associate
July 15, 2025

Hello. First, thank you for the quick reply. I am a hardware PCB layout Engineer and have very low knowledge and experience in building firmware. I have to do it now because at least I want to test that the SPI bus connections are ok and read just for testing purposes the X, Y, Z axis. 

So far, the WhoamI register, as you saw on the terminal log I can read. How can I get some very simple code to test the Axis of this accelerometer? Can you advise me on a link or something? 

I tried from gitHub but the code was written for another platform and even "by my code modification(I am not sure how good I was)", could not successfully accomplish the task. 

I will appreciate any support.

Thankyou 

Andrew Neil
Super User
July 15, 2025
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.