Post Go back to editing

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);

}