AnsweredAssumed Answered

HMC629ALP4E

Question asked by satya247 on Jul 26, 2017
Latest reply on Jul 28, 2017 by s.ilke

Dear Sir/Madam,

 

I am using HMC629ALP4E RF Digital step attenuator.

 

When I am controlling this via SPI protocol, It is setting up for different attenuation rather than a single value.

 

For example 

I am using a Tactile Switch to send SPI command

 

uint8_t Spi_DAdata[2] = {0x0F,0x00}; // E0 = 3dB, D0 = 6dB, B0 = 12dB, 70 = 24dB.
uint8_t Spi_DAdata1[2] = {0x0D,0x00};
uint8_t Spi_DAdata2[2] = {0x0B,0x00};

while(1)

{

   if (switch == 1)

   {

   write_spi(&Spi_DAdata2,1,1);

   }

   else{

         led_toggle(led0);

         }

}

void write_spi(uint8_t *data_out, int len, uint8_t CS)
{

         if (CS == 1)
               {
               struct spi_device device ={
               .id = IOPORT_CREATE_PIN(PORTD,1)
               };

            spi_select_device(&SPIC, &device);   // setting Latch Enable LOW 
           delay_us(10);
            for (i = 0; i < len; i++)
               {
               spi_put(&SPIC, data_out[i]);
               while(!spi_is_tx_ok(&SPIC)){
                }
            }
spi_deselect_device(&SPIC, &device);    // setting Latch Enable HIGH
delay_us(100);
spi_select_device(&SPIC, &device);      // setting Latch Enable LOW 
}

 

I checked the scope which is giving me correct data.

but I couldn't understand when I press a button HMC629ALP4E behave wiredly

When I press the switch/ button first time it will set to -45 db attenuation

second press  -24dB

third press       -12dB

fourth press     - 6 dB

Fifth press      -3dB

 

I couldn't understand this behavior of HMC629ALP4E attenuator.

 

Can any one please help me out ?

Outcomes