Post Go back to editing

AD9546 Eval Board

Category: Hardware
Product Number: AD9546

Hi eveyone,

I have AD9546 eval board and I used to do my test via Eval Software on my PC.

Now, I would like to control the chip itself with a raspberry pi I2C interface. 

I know that AD9546 works with default SPI mode. 

How can I change this mode to I2C and reach to the AD9546 over header pins ?

What should I change on the eval board?

Thanks,

Oguzhan

  • HI,

    we put the connector P503 to interface a Raspberry PI Model B+ to the AD9546.

    Put all the jumpers at P507 between middle pins 2, 5, 8, 11, 14 and the pins labelled COMMUNICATE VIA P503 4,7,10,13. THis connector manages the SPI or I2 C ports.

    Put the jumpers at P508 between the middle pins 2, 5, 8, 11, 14 and the pins labelled COMMUNICATE VIA P503 4, 7, 10, 13. This connector manages M0, M1, M2, M3 and M4 pins.

    Petre

  • Hi,

    We put the jumpers but we still could not reach to the AD9546 via I2C.

    When we check the P503 interface pinout. It's not matching with raspberry pi model B. 

    Somehow we can see the I2C device (4A, 4B, 48 ,49) adress on raspbery pi console but when we want to read temperature data, it returns nothing.

  • HI,

    I'm sorry, I was not quite correct in identifying the Raspberry PI board that can be connected to the AD9546 evaluation board. It is Raspberry PI 3 Model B+.

    We give more info about P503 here: https://wiki.analog.com/resources/eval/ad9546-user-guide#p503_connectorusb_interface

    Petre

  • Hello again,

    We use the Raspberry Pi 3 Model B+ board. When we check the P503, It is not compatible for I2C. Because It does not match with the I2C pins on 40-pin header of Raspberry Pi 3 Model B+. There is nothing on 3-5 pin numbers as you see below. It is designed for SPI communication.

    Figure1. 

    As a reference you can check the Raspberry Pi 3 Model B+ pin out.

    Figure2.

    Anyway, We have tried the communicate through the SDIO_SDA_DUT and SCLK_SCL_DUT pins(P512 header), we have changed the "0(zero) ohm" resistors and wished to see different something but nothing changed. We have changed the related pins as you can see from the datasheet as well and attached here.

    Figure3.

    Figure4.

    We have configured the M4 pin as HIGH, M5 pin as LOW and M6 pin as HIGH. I can see the address on Raspberry as 0x4A, When I want to read something It just throws the unrelevant values.
    We use the this script;

    github.com/.../adi-ad9546

    If there is anything I missed that needs to be changed, I would be happy if you could help me. Thank you.

  • HI,

    I'm sorry, but I do not support the script you found on github. I do not know who created it and what it does.

    I recommend using the evaluation software to create the AD9546 configuration you target, then use the Raspberry PI to download it into the AD9546. But you are on your own doing the Raspberry PI implementation. I do not know how to do it.

    Petre

  • I wrote a simple python script which can read the temperature sensor from 0x3003 and 0x3004 register but it gives just "0". As I said, I can see the address and reach it but I can not read the data accurately. What can be the main reason ? Are you able to check the I2C configuration which I have provided for you in my last post ? Is it totally true way to configure I2C ? 

    The python script is :

     

    import smbus2

    import time

     

    # I2C address of the AD9546 

    AD9546_I2C_ADDRESS = 0x4A 

     

    # Register addresses for temperature sensor output

    TEMP_SENSOR_REG_LOW = 0x3003

    TEMP_SENSOR_REG_HIGH = 0x3004

     

    # Initialize the I2C bus

    bus = smbus2.SMBus(1)  # 1 indicates /dev/i2c-1

     

    def read_temperature():

        try:

            # Read the lower 8 bits of the temperature value

            temp_low = bus.read_byte_data(AD9546_I2C_ADDRESS, TEMP_SENSOR_REG_LOW)

            

            # Read the upper 8 bits of the temperature value

            temp_high = bus.read_byte_data(AD9546_I2C_ADDRESS, TEMP_SENSOR_REG_HIGH)

            

            # Combine the two bytes to form the 16-bit signed temperature value

            temp_raw = (temp_high << 8) | temp_low

            

            # Convert from 16-bit signed to proper negative value if needed

            if temp_raw & (1 << 15):  # if sign bit is set

                temp_raw -= (1 << 16)

            

            # Calculate the temperature in Celsius

            temperature = temp_raw * (2 ** -7)

            

            return temperature

        

        except Exception as e:

            print(f"Error reading temperature: {e}")

            return None

     

    def main():

        while True:

            temp = read_temperature()

            if temp is not None:

                print(f"Current Temperature: {temp:.2f} °C")

            time.sleep(1)  # Wait for 1 second before reading again

     

    if __name__ == "__main__":

        main()

  • HI,

    I always recommend to first read registers that after power up have non zero value. Like the register 0x0004 which has a default value of 0x21. So try to read this register first.

    You need to put the AD9546 in I2C mode first:

    - M4 pin to high (jumper between pins 1 and 2 at P602. I would take out R660 to avoid any contention with the U602).

    - M5 and M6 corresponding the the chip I2C address (see table 103 in the data sheet). Set jumpers at P602 accordingly. Install R521=R519=0 and take out R518 and R520. Take out R661 and R662.

    - you need to  use pin 2 (SCLK/SCL) and pin 4 (SDIO/SDA) for 2C. This means jumper SDIO at P507 between pins 4 and 5 and jumper SCLK at P507 between pins 1 and 2. One thing I realized is that these lines do not have resistor pull ups. So you may need to introduce pull up resistors on the Raspberry PI board. Put the scope probes on these lines and see how they behave before U502 (on Raspberry PI side) and after (on AD9546 side).

    See if you can read the register 0x0004 with these settings. Then you can go to writing a register and read it back.

    Petre

  • Hello again,

    I have tried what you said and you can follow the steps what I have done below.

     

    1- I wrote a python script which can read the value from "0x0004". The related basic python script;

    import smbus2

    import time

     

    # I2C address of the AD9546 (you need to set this according to your configuration)

    AD9546_I2C_ADDRESS = 0x48  # Replace with the correct I2C address

     

    # Register address to read (0x0004)

    TARGET_REGISTER = 0x0004

     

    # Initialize the I2C bus

    bus = smbus2.SMBus(1)  # 1 indicates /dev/i2c-1

     

    def read_single_register():

        try:

            # Read the value from the target register

            reg_value = bus.read_byte_data(AD9546_I2C_ADDRESS, TARGET_REGISTER)

            

            # Print the raw register value

            print(f"Register 0x{TARGET_REGISTER:04X}: 0x{reg_value:02X}")

            

            return reg_value

        

        except Exception as e:

            print(f"Error reading register 0x{TARGET_REGISTER:04X}: {e}")

            return None

     

    def main():

        while True:

            reg_value = read_single_register()

            if reg_value is not None:

                # Further processing can be done with reg_value if needed

                pass

            time.sleep(1)  # Wait for 1 second before reading again

     

    if __name__ == "__main__":

        main()

    2- I have checked the Raspberry Pi 3 Model B+'s pull-up resistors(GPIO2, GPIO3) and already It has as built-in on board. You can see below;

    Figure1.

    3- I have took out R518, R520, R660, R661, R662 resistors. Install R521, R519 with zero ohm.
    4- Set M4 HIGH, M5 LOW, M6 HIGH from P602 (0x4A address)
    5- Set the jumpers on P507 for SCLK and SDIO. 

    5-  Use the SCLK and SDA from P503.

    When I have check the tool i2cdetect on Raspberry Pi, I see the 0x4A and sometimes it is disappering. It does not work actually again.

  • HI,

     I cannot play with the Raspberry PI and verify you. This is something you have to do it yourself.

    Put the oscilloscope probes on all the pins (M4, M5, M6) involved in the AD9546 selecting I2C communication. See if they have the right levels that you defined.

    You then need to put the oscilloscope probes on the I2C signals as they leave the PI controller and follow them to see if and how they arrive at the AD9546. See if they match the protocol from Table 119, page 204 in the data sheet.

    Petre