2020-08-26 04:30 AM
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?
2020-08-26 07:36 AM
How are your pull ups on the I2C bus?
2020-08-26 07:43 AM
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.
2020-08-26 01:50 PM
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
2020-08-27 04:50 AM
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.