I2C Master read data by sense registers

For LTC4151, I am supposed to read the current (ampere) value that is in sense registers (0x00 and 0x01)

the steps I have followed to implement this in VHDL code is

S1: start->slave address->write->slave ack ->control register address (0x06h)-> slave ack-> data  written (10011000)->slave ack->stop

S2: start ->slave address->write->slave ack ->control register address (0x06h)-> slave ack-> restart->slave address-> read-> slave ack->control register data read -> master nack -> stop

S3: start ->slave address->write->slave ack ->sense A register address (0x00h)-> slave ack-> restart->slave address-> read->slave ack->  data read (8 MSB) -> master nack -> stop

S4: start ->slave address->write->slave ack ->sense B register address (0x01h)-> slave ack-> restart->slave address-> read->slave ack-> data read (4 LSB) -> master nack -> stop

but i am just held up in step 3

S1 ,S2

S3 :start ->slave address->write->slave ack ->sense A register address (0x00h)-> slave ack-> restart->slave address-> read-> slave ack-> data read (8 MSB) -------

the data read is continuous and it is not terminating even after giving stop condition, Because of this I am not able to proceed for step S4.

 I want to read 1 byte data for sense A register (0x00) and another 1 byte data for sense B register (0x01). I need to know what settings has to be made and written into control register (0x06) so that it enables only the sense registers to put out the data and I2C master should be able to read it irrespective of the register address provided?   

the sense A register (0x00) seems to be continuously read some data values and it is not terminating even when stop condition is given. because of this I am not able to read sense B register (0x01) value also.

I think it is related to how the setting is done in the control register.

Could you please help me in resolving the issue?

Thank you

  • 0
    •  Analog Employees 
    on Nov 24, 2020 3:33 AM 1 month ago

    Hi LR237,

      I would recommend setting up register 0x06 as such:

    This will disable the page reads and test mode, set up a single ADC snapshot for the sense register, and keep the stuck-bus timer enabled.  Then, do a read word of the sense register.  I you are able to get sensible data back from the read (per our previous conversation), you can then switch to continuous mode, if needed, and see how it goes.   Let me know how it goes and if you have any other questions!

    Thank you and best regards,

    Brad

  • Hi,

    I have some queries.

    1. is it really necessary that control register (0x06) has to be configured first by writing the data (10000100) into it  and then perform read operation for registers (0x00 and 0x01)?

    2. can i directly read the data from registers (0x00 and 0x01) without configuring the control register?

    3. are the below steps which iam following is correct or not?

    S1: Start > slave address > write(0) > slave ack >control register address (0x06) > slave ack >data written (10000100) > slave ack > stop

    S2: Start > slave address >write (0) > slave ack > reg1 (0x00) > slave ack > restart > slave address > read (1) > slave ack > data read > stop

    S3: Start > slave address >write (0) > slave ack > reg2 (0x01) > slave ack > restart > slave address > read (1) > slave ack > data read > stop

    4. can i just follow the below mentioned step to read data? will it work without configuring the control register (0x06)?

    Start > slave address >read (1) > slave ack > reg1 (0x00) > slave ack > data read > stop

    Start > slave address >read (1) > slave ack > reg2 (0x01) > slave ack > data read > stop

  • 0
    •  Analog Employees 
    on Dec 2, 2020 2:21 AM 1 month ago in reply to LR237

    Greetings LR237,

       Please see the response which was posted in one of your duplicate threads: read data by sense registers - Q&A - Processors and DSP - EngineerZone (analog.com).

    Thank you and best regards,

    Brad