This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMAG5273: Reading register not working

Part Number: TMAG5273

I am writing to device config register following address to put it in continues measurement mode.

self._write(0x01, '\x02')
I can write without error but reading it back always gives 0x78. So I can not verify device config register value.
I am using Python smbus library to read the sensor.
Why does it read 0x78 when I am writing 0x01.  I have tried to change other configuration register as well but they gives the same result 0x78.
Does anyone know about this issue ? Am I doing something wrong ?
I have tried another python library periphery as well and linux i2cget utility as well but they all gives same result.
  • Hi Anil,

    Thank you for posting to the Sensors forum!

    What device variant are you using? Can you share a capture of the I2C communication using a logic analyzer?

    Best,

    ~Alicia

  • I am using A1 variant. Part number #TMAG5273A1QDBVT

    Send you soon the recording from logic analyzer. 

  • writing 0x01 to 0x00.

    reading 0x00 from python smbus logic analyser display 0x36 and output is 0x78.

    Same issue happens when I try to write another registers. It reads back 0x78.

  • Hi Anil,

    Based on the first image shared, it looks like you are writing more than just 0x01 to register 0x00. Was that intentional? I would expect that a write to 0x00 would look something like the image below, unless you are doing a write to multiple registers.

    Also, because you are writing 0x01 to 0x00, you are setting your I2C_RD to the 1-byte 16-bit read. This means that your reads will need to look like one of the following, depending on how many axis are enabled.

    Additionally, because you are in this mode, anytime you do a read you will only see data from the enabled results registers as well as the CONV_STATUS (and CRC depending on whether it is enabled). If you would like to be able to read back the device configuration registers, I would recommend leaving the device in the standard 3-byte read mode until you are reading to only read back the result registers.

    reading 0x00 from python smbus logic analyser display 0x36 and output is 0x78.

    I am not sure why 0x36 is being shown as the address being read from. My initial thought are either 0x36 is somehow the address that is being read from in the code, or there is some kind of timing issue. Though the format of the I2C read isn't what I would expect from either a 1-Byte read or the Standard 3-Byte read which should look something like the below, which is a read of register 0x0C:

    The following code examples may serve as a useful guide for the different I2C read modes for this device: TMAG5X73-CODE-EXAMPLE

    Best,

    ~Alicia

  • I can successfully read the device address and result data.

    Its only when I try to read configuration data.

    How do I confirm if the configuration bytes are configured correctly ?

    If you have any python library that works well with sensor please send link. It will help a lot.

  • Hi Anil,

    In order to be able to read the configuration bytes, the device needs to be in Standard 3-Byte Read mode.

    If the device is in this mode, you should be able to easily read the configuration bytes. For example, say I were to write 0x05 to the CONV_AVG bits in DEVICE_CONFIG_1, as shown on the left below. I should be able to read that same register and see that the register has the same value that was just written to it, as shown on the right below.

      

    Unfortunately, the code examples that were written for this device were done in C, though they should still be useful as a reference point.

    Best,

    ~Alicia