AnsweredAssumed Answered

SPI Clock setting in ADF4351

Question asked by thirukannan.perumal@eldaas.com on Apr 15, 2014
Latest reply on Apr 22, 2014 by icollins

Hi,

 

I am using ADF4351 in my circuit. For this i need to set  6 registers through SPI protocol. But different time limit has given in datasheet for clock input like below mentioned diagram .But we can't change time limit in between the data transmission in the SPI.

 

 

 

So for this I written following code. Using this i got MUXout  correctly but i am not getting the RFout from PLL . Is this code correct or how to write code. please help me.Below is my code

 

reg0=0x00540000;

reg1=0x08008011;

reg2=0x0C008F42;        //R counter

reg3=0x000004B3;

reg4=0x00CA003C;

reg5=0x00D80005;

//GPIO_SetBits(GPIOE, GPIO_Pin_12);

pll_spi_send(reg5);

pll_spi_send(reg4);

pll_spi_send(reg3);

pll_spi_send(reg2);

pll_spi_send(reg1);

pll_spi_send(reg0);

 

}

 

    void pll_spi_send(unsigned long int reg)

{

int i;

unsigned long int rer_val;

       GPIO_SetBits(GPIOE, GPIO_Pin_15);  // pin 15 is LE

 

    for(i=0;i<32;i++)

    {

        GPIO_ResetBits(GPIOE, GPIO_Pin_15);

    //    GPIO_ResetBits(GPIOE, GPIO_Pin_12);

        rer_val=((reg<<i)&0x80000000);

        if(rer_val==0x80000000)

            {

            GPIO_SetBits(GPIOE, GPIO_Pin_14);//pin 14 is data

             }

        if(rer_val==0x00000000)

            {

            GPIO_ResetBits(GPIOE, GPIO_Pin_14);

            }

         GPIO_SetBits(GPIOE, GPIO_Pin_13); //pin 13 is clock

         GPIO_ResetBits(GPIOE, GPIO_Pin_13);

     }

    // GPIO_SetBits(GPIOE, GPIO_Pin_15);

}

 

Regards,

Thirukkannan.P

Outcomes