2025-09-11 4:44 AM
I am using the ASM330LHH connected to the processor via 4-wire SPI communication. I’m trying to read the WHO_AM_I register, which should return 0x6B according to the datasheet, but I keep getting 0xFF. The CS line is set correctly before and after the transfer. What could be causing this incorrect data read? If the device isn’t found (WHO_AM_I doesn’t return 0x6B) and I still try to read accelerometer and gyro data, and I am getting data, will those values be completely random?
2025-09-11 4:53 AM
Welcome to the forum.
Please see How to write your question to maximize your chances to find a solution for best results.
In particular, please give full details of your setup - board(s) used, schematics, etc.
Some good, clear photos often help.
Also show your code - instructions in the above link.
@Jigs wrote:but I keep getting 0xFF.
0xFF is all ones, so possibly nothing at all is happening on the SPI - or, at least. on MISO.
@Jigs wrote:The CS line is set correctly before and after the transfer.
Have you verified that in the hardware?
Use an oscilloscope to verify that your SPI signals are good and clean and properly connected.
Use a logic analyser to see the SPI comms...
2025-09-11 5:58 AM
> What could be causing this incorrect data read?
Here are some possibilities:
0xFF is a string of 1s and indicates the chip is not responding at all.
> If the device isn’t found (WHO_AM_I doesn’t return 0x6B) and I still try to read accelerometer and gyro data, and I am getting data, will those values be completely random?
You're never going to get random data. It'll probably also be 0xFF.