cancel
Showing results for 
Search instead for 
Did you mean: 

WHO_AM_I issue in ASM330LHH

Jigs
Associate

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?

2 REPLIES 2
Andrew Neil
Super User

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...

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.
TDK
Super User

> What could be causing this incorrect data read?

Here are some possibilities:

  • Bad code.
  • Bad wiring.
  • Not powered.
  • Minsterpretation of data.

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.

If you feel a post has answered your question, please click "Accept as Solution".