Post Go back to editing

AD5522 SPI command

Category: Hardware
Product Number: AD5522

Hi and thank you in advance for your help.

I have an AD5522EBUZ evaluation board that works well with the software. I'm trying to connect my own MCU to the J3 connector pins with SPI communication to control the AD5522. The commands I send don't seem to make it work.

Here are my connections:

MCU ==> AD5522 J3 connector

MOSI ==> SDI (pin17)

MISO ==> SDO (pin16)

CLK ==> SCLK (pin18)

SYNC ==> SYNCB (pin15)

GND ==> GND (pin30)

DVCC = 3.3VDC like my MCU.

Then I moved the jumpers as shown in table 1 of the Wiki except LK3 to use the reset button.

Afterwards, I analyzed the SPI frames when I use the software included with the dev kit. Could you tell me where I can find the frames to send at startup and the order?

AD5522 frame at startup (I was able to replicate the same SPI messages with my MCU):

0x03FE4A0 (2 times in a row, information in the wiki)

0x18000 (6 times in a row)

0xCD8000 (1 time)

0x0 (1 time)

0x2000 (1 time)

0x1A000 (2 times in a row)

0x03FE4A0 (3 times in a row, information in the wiki)

0x0F21B300 (1 time, information in the wiki)

To generate an output voltage, the SPI frames are for example:

0x0FCDFFF = 11.25VDC This works with the software but not with my MCU (although I have the same type of signals)

What I can't explain is that the MOSI signal I send replicates to MISO, even if the MISO of my MCU is not connected. Are there any other jumpers to change places?

Here is a photo of the jumpers if that helps find the source of my problem

Thanks for your help.

Thread Notes

  • Here is my code, if it helps to find the reason why I can't control the AD5522

    from machine import Pin, SPI
    import time

    BUSY = Pin(27, Pin.IN)
    RESET = Pin(21, Pin.OUT)

    spi = SPI(1, baudrate=70000, polarity=0, phase=0, sck=Pin(14), mosi=Pin(13), miso=Pin(12))
    cs = Pin(5, Pin.OUT)

    def SEND_COMMAND(command, byte=4):
       time.sleep_ms(3)
       WAIT_BUSY()
       data = command.to_bytes(byte, 'big')
       cs.off()
       spi.write(data)
       cs.on()

    def WAIT_BUSY():
       while BUSY.value() == 0:
       print('busy')
       time.sleep_ms(1)

    RESET.value(1)
    time.sleep(1)
    RESET.value(0)
    time.sleep(1)
    RESET.value(1)
    time.sleep(1)

    SEND_COMMAND(0x003FE4A0)
    SEND_COMMAND(0x003FE4A0)
    SEND_COMMAND(0x003FE4A0)
    SEND_COMMAND(0x003FE4A0)
    SEND_COMMAND(0x18000)
    SEND_COMMAND(0x18000)
    SEND_COMMAND(0x18000)
    SEND_COMMAND(0x18000)
    SEND_COMMAND(0x18000)
    SEND_COMMAND(0x18000)
    SEND_COMMAND(0xCD8000)
    SEND_COMMAND(0x0)
    SEND_COMMAND(0x2000)
    SEND_COMMAND(0x1A000)
    SEND_COMMAND(0x1A000)
    SEND_COMMAND(0x003FE4A0)
    SEND_COMMAND(0x003FE4A0)
    SEND_COMMAND(0x003FE4A0)
    SEND_COMMAND(0x003FE4A0)
    SEND_COMMAND(0x0F21B300)

    Thanks

  • Hi,  

    Thanks for your interest in AD5522. I will be moving this inquiry to the Automatic Test Equipment page for better monitoring.

    To help address your inquiry, I would like to request for an oscilloscope shot of the four signals lines (SDI, SDO, SCLK and CSB) when you are trying to for 11.25V. This would help us have a better view of the framing on our end. Looks like you've got all the jumpers in their right configurations and all SPI lines connected properly.

    Also, I would like to clarify if this is a typo, "0x0FCDFFF = 11.25VDC This works with the software but not with my MCU (although I have the same type of signals)". If this is not, you have probably forgotten to add an extra F at the end. Forcing 11.25V across all channels requires a command 0x0FCDFFFF.

    Best regards,
    Mac

  • Hi  ,

    Thanks for help. You are right, I was wrong in posting my message regarding 0x0FCDFFFF.

    I have a two channel oscilloscope, so I tried to take some captures to help.

    Here are the commands sent corresponding to the image:

    SEND_COMMAND(0x003FE4A0)

    SEND_COMMAND(0x003FE4A0)

    SEND_COMMAND(0x0F21B300)

    SEND_COMMAND(0x0F21B300)

    SEND_COMMAND(0x0FCDFFFF), I receive in MISO

    SEND_COMMAND(0x0FCDFFFF)

    SEND_COMMAND(0x0F21B300) MOSI vs MISO

    SEND_COMMAND(0x0F21B300)

    CLOCK vs CS

    CLOCK vs CS

    Do you need another image to be more precise?

  • Hi,  

    Thanks for your images. Your oscilloscope shots show that the SDI transitions at the same time the SCLK falls. The datasheet says that it has to be otherwise. Your SDI must be at steady state at the SCLK falling edge so it can be sampled properly. Please see this snippet below:

    You can first change this in your microcontroller setting. I'll go to the bench if your system still doesn't work after this change so I can help you further with the debug.

    Thanks,
    Mac

  • Hi  ,

    I just checked on the evaluation board and it doesn't match the picture. The data is stable when the clock is high.

    Here is an oscilloscope sensor from the evaluation board:

    I will check if I have the possibility to modify it on my mcu in the meantime.

    Thanks

  • Hi  ,

    You were right, I just modified the code to sample on the falling edge and it works. I was able to modify the outputs with the command 0x0FCDFFFF.

    Thanks a lot for your help.