Post Go back to editing

HMC542BLP4E Digital Attenuator Control Issues with 3.3V Microcontroller

Thread Summary

The user is troubleshooting an issue with the HMC542B digital attenuator not changing attenuation after SPI transfer, despite correct SPI frames shown on a logic analyzer. The final answer suggests capturing the digital streams on a multi-channel oscilloscope to verify CLK, LE, Resetbar, and data lines, and checking for data on the Serial Out line after clocking beyond 8 cycles. The HMC542B and STM32 MCU with SPI (Mode 0, CPOL=0, CPHA=0) are involved.
AI Generated Content
Category: Software
Product Number: HMC542B

Hello,
I am working with the HMC542B digital attenuator. I use STM32 MCU with SPI (Mode 0, CPOL=0, CPHA=0). On my logic analyzer, the SPI frame looks correct (8 bits, MSB first). However, the HMC542B does not change attenuation after SPI transfer.

  • RESET pin is tied high after initial low pulse.

  • LE pin is toggled after each frame.

  • I tested sending 0x00, 0x3F, etc. but the attenuation stays the same.

  • Supply is correct (per datasheet).

Questions:

  1. Why does the HMC542B ignore the SPI frames even though the logic analyzer shows proper data?

  2. Does the data need to be bit-reversed or complemented before shifting in?

  3. Could you please provide a minimal working SPI example code for HMC542B (e.g., STM32 C or Arduino)?

Thank you.


  • Are you able to capture the digital streams on a multi-channel oscilloscope (CLK, LE, Resetbar and data)? Also if you continue to clock beyond the 8 cycles, can you check to see if data is coming out of Serial Out?

  •    

    I’m having a difficult time right now, and a lot of people are counting on me. Can I get in direct contact with you to discuss this?

    As for the timing diagram, I’ve correctly shown SCK, LatchE, and MOSI, but I feel that at first the adjustment didn’t work properly and the values jumped incorrectly, and later it just got stuck. Thanks for help !

    “This is MOSI and SCK, after 8 cycles comes the latch enable.”



  • I think that the image you provided is from the screen of the logic analyzer. It would be good to put some oscilloscope probes down on pins 19,20, 21,22 and 24 to see the signals that are hitting the chip. 

    In the picture, I see eight clock pulses (I assume that these drive pin 21 (Shift Clock). I also see a logic high signal that goes low after the rising edge of the sixth pulse and goes back high after the rising edge of the eight pulse. What pin is this driving? If this is the Latch Enable signal, it should be low during the eight clocks and should pulse high after the eight rising edge of the clock (it only takes six bits to set the attenuation but you need to write two dummy bits to make it an 8-bit write. 

    I assume that one of the other traces is the data line which is either all high or all low. 

  • @enash I set the latch enable from low to high to latch the data line at a high level, and each rising clock pulse corresponds to data being written in.Do you think it is possible that this attenuator is dead? I used to control it with the old code, but the values were incorrect, and gradually it stopped responding altogether.

  • The sequence you describe is correct (eight clocks followed by a low-to-high to low pulse on Latch Enable). But the image from the logic analyzer showed something different (eight clock cycles with a negative going pulse (not sure what pin it was driving) during the last two clock cycles). 

    Regarding whether the device is damaged, that is always a possibility. Check the current flowing into the VCC pin, it should be around 2.8mA. If it is very different from this number (say 0.5mA to 10mA), that would be an indicator that the part is damaged. 

  • Closing out this support request as I've not hear back from you.