ADRF6720-27 SPI issue

Hi Everyone,

I recently bought ADRF6720-27 and trying to control it via SPI , but it is not working.

When I read the datasheet, it shows how to transfer data via SPI " CMD register followed by Read/Write than data(16 bits) "

What I could get is should I add Read/Write bit to the cmd register ?

Could anyone help me out please ? code is attached below

spi_data_out[0] = 0X01;
spi_data_out[1] = 0x04;
spi_data_out[2] = 0x00;


write_spi_RFSource_Mixer(spi_data_out,3,0);

spi_data_out[0] = 0X10;
spi_data_out[1] = 0x04;
spi_data_out[2] = 0x00;

write_spi_RFSource_Mixer(spi_data_out,3,0);

void write_spi_RFSource_Mixer(uint8_t *data_out, int len,int mode){

switch (mode)
{
case 0: spi_master_setup_device(&***,/* &device,*/SPI_MODE_0,500000,0);
spi_enable(&***);
break;

case 1: spi_master_setup_device(&***,/* &device,*/SPI_MODE_1,500000,0);
spi_enable(&***);
break;

case 2: spi_master_setup_device(&***,/* &device,*/SPI_MODE_2,500000,0);
spi_enable(&***);
break;

case 3: spi_master_setup_device(&***,/* &device,*/SPI_MODE_3,500000,0);
spi_enable(&***);
break;
}


struct spi_device device ={
.id = SPIC_SPI_RFDSACS       // CS for Mixer PORT C, PIN 2
};

spi_select_device(&***, &device);   // Chip select is active high
delay_us(10);
for (int i = 0; i < len; i++)
{
spi_put(&***, data_out[i]);
while(!spi_is_tx_ok(&***)){

}
//delay_us(10);
}
spi_deselect_device(&***, &device);
delay_us(10);

}

Parents
  • +1
    •  Analog Employees 
    on Sep 8, 2020 6:42 PM

    Hello 

    ADRF6720-27 is configured via a 3 pin SPI ports(SCLK,SDIO,/CS). Please refer to the "Digital Logic" section in Table1 for Logic level and Table 2 for timing requirement. It is 24 bits protocol (7bits address + R/W + 16 bits data). On a write operation, configure it at 24bits along with setting R/W bit ="0" and set that bit at "1" for a read operation. Data is 16 bits long, not 8 bits. It looks like you write only 8 bits in your code.

    So first try to write a register at 24 bits and read back that specific register to verify SPI interface. 

    Please refer to "Serial Port Interface" Section at page 22 of datasheet and the User Guide of that evaluation board that includes the SPI schematic of that board.

    www.analog.com/.../ADRF6720-27-EVALZ_UG-742.pdf

    Thanks

    Tony

Reply
  • +1
    •  Analog Employees 
    on Sep 8, 2020 6:42 PM

    Hello 

    ADRF6720-27 is configured via a 3 pin SPI ports(SCLK,SDIO,/CS). Please refer to the "Digital Logic" section in Table1 for Logic level and Table 2 for timing requirement. It is 24 bits protocol (7bits address + R/W + 16 bits data). On a write operation, configure it at 24bits along with setting R/W bit ="0" and set that bit at "1" for a read operation. Data is 16 bits long, not 8 bits. It looks like you write only 8 bits in your code.

    So first try to write a register at 24 bits and read back that specific register to verify SPI interface. 

    Please refer to "Serial Port Interface" Section at page 22 of datasheet and the User Guide of that evaluation board that includes the SPI schematic of that board.

    www.analog.com/.../ADRF6720-27-EVALZ_UG-742.pdf

    Thanks

    Tony

Children
No Data