cancel
Showing results for 
Search instead for 
Did you mean: 

I2C data always 0x00

CGrov.1
Associate II

I have an stm32L476RG and am trying to read data from a digital magnetometer (MMC5983MA). The I2C connection is working, and I am able to read the slave ID and the slave status. However, whenever I try to read data, it always returns 0x00 for all three axis of the magnetometer, and the internal temperature sensor.

I am using firmware that has been tested on dev boards and works fine, on the same PCB there is an accelerometer that uses the same HAL library and is functioning.

Any ideas?

4 REPLIES 4
LMI2
Lead

How are your pull ups on the I2C bus?

I did some calculations and then confirmed them on the board. I found I needed 1.5k to get a clean signal at 400kHz. Since I am getting the address and status from the device, I know that the bus is able to be pulled low and isn't getting stuck there.

I personally would start with reading the magnetometer's DS. It may have power or clock gating registers which may need to be enabled first.

What is "slave ID and the slave status"?

JW

The slave ID and slave status is just reading from those registers, the ID is set in the datasheet and I use the status to check if a data sample has been taken. It just shows that I am able to read from the magnetometer. I have gone through the DS and am enabling the registers I need, I'm pretty sure about this part as that was my first thought and I spent a lot of time reading through the DS.