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.

SM72442: I2C Communication with SM72442 and Raspberry pi

Part Number: SM72442
Other Parts Discussed in Thread: SM72295

I am trying to read/write SM72442 registers using I2C from Raspberry Pi. I am able to detect my device using "i2cdetect -y 1" and it has an address 0x03. For now, I am trying to read the contents of reg0. Please find my code below:

import smbus

bus = smbus.SMBus(1)

device_id = 0x03

register = 0xE1    #base register address 0xE0

try:

    b = bus.read_byte_data(device_id, register)

    print(hex(device_id), b)

except:

    pass

It prints ('0x3', 7). Apparently, read_byte_data only tells the number of bytes for that registers. However even if I change the register number to any other value, it always gives a value of 7. From the documentation, I understand that I need to first send the address, get an ack from SM72442, send the command register, get and ack, and do repeated start onwards. However, I am unable to figure out how to do it with python smbus. Any help on reading/writing registers with smbus or any other linux-based low level I2C library would be really helpful. 

  • Can you reference to the following e2e thread, especially the last post by Florent? The SM7442 and SM7445 are very similar.
    e2e.ti.com/.../681745
  • Hi, thanks a lot for the suggestion. It helped me significantly. I am able to read the registers now but I am facing a strange issue. If I read the content of Reg3, Reg4, and Reg5, they appear to be correct.

    My Python code is given below:

    #######
    import smbus
    from time import sleep
    bus = smbus.SMBus(1) # 1 indicates /dev/i2c-1
    device_id = 0x06
    register = 0xE5
    data=bus.read_i2c_block_data(device_id, register, 8)
    print data
    #######

    Reg3 gives [7, 24, 160, 128, 1, 10, 0, 0]
    Reg4 gives [7, 0, 0, 0, 0, 0, 0, 0]
    Reg 5 gives [7, 24, 160, 128, 1, 10, 0, 0]

    All of these registers are R/W and the values returned are correct at reset. However, if I try to read the Reg0 or Reg1, they give random values which changes every time I access. Could it be possible that I have nothing connected at the respective pins and leaving them hanging is causing this issue? Do I need to set external values at ADCs even if I want to set V/I limits internally? Also, would this issue get solved when I connect sense resistors? I am currently checking it with the basic power circuitry. Please comment on the issue.
  • Hope the following help:

    It seems being caused by the floating pins, because reg0 is the programing status, set by A1-6 pins.

    Regarding reg1, the detailed reg1 description

    Bits Field Reset Value R/W Bit Field Description

    55:54 RSVD 2'h0 R Reserved for future use.
    53:44 Vout 10'h0 R Voltage out
    43:42 RSVD 2'h0 R Reserved for future use.
    41:32 Iout 10'h0 R Current out
    31:22 RSVD 10'h0 R Reserved for future use.
    21:12 Vin 10'h0 R Voltage in
    11:10 RSVD 2'h0 R Reserved for future use.
    9:0 Iin 10'h0 R Current in

    Thanks
  • Thanks for the response. I have been able to interpret the values I read from the registers. I have one question about setting the maximum voltage and current using the registers instead of the external circuitry. In SM3320 design, the voltage is set using registers and that part is very well explained. I have equation for the given divider circuit and I am able to set the register values for a desired output voltage. However, as the current limit in that circuit is done externally, the governing equation for doing it with register is not explained in the SM3320 reference design or SM3320 datasheet. 

    For example, in SM3320 circuit, the AIOUT is connected to BOUT from the SM72295 directly. Can anyone please explain how to set the register values for that scenario if I want to enforce the limit internally?