AD8285
Recommended for New Designs
The AD8285 is designed for low cost, low power, compact size, flexibility, and ease of use. It contains four channels of a low noise preamplifier (LNA...
Datasheet
AD8285 on Analog.com
Hi Team,
I am currently working on interfacing with the AD8285 using a Blackfin processor. During my testing, I observed an issue when attempting to read and write to the device. Specifically, when I attempt to read the default address (0x01), I am able to retrieve the expected values from the register. However, when I write to the register and then attempt to read it back, I consistently receive a value of 0x00, regardless of the data written.
I am unsure where the value might be getting reset or what could be causing this issue. Could anyone please provide guidance on potential causes for this behavior or any suggestions on how to troubleshoot the issue.
I'm configuring the ADC through SPO0 line with sel1 in which, during write I'm able to see the data dump through the scoping.
I have checked the waveform in scope in which cmd, address, values are going correctly x20, x1A, xDE, xAD.
Also for ref I have provided the codes in which I have been configuring and read & write is happing.
uint8_t readPointer[16] = {0x00, 0x00, 0x01, 0xA0};
uint8_t ADC = 0u;
if(spi_init(ADC) != API_SPI_SUCCESS)
{
perror("ADC init failed!.\n");
}
if(spi_ADC_cfg(ADC, clock) != API_SPI_ADC_CFG_SUCCESS)
{
perror("ADC CFG failed!.\n");
}
// 0xDE, 0xAD
spi_readwrite(ADC, &readPointer[0], 4);
readPointer[0] = 0x00;
readPointer[1] = 0xDA;
readPointer[2] = 0x1A;
readPointer[3] = 0x20;
spi_readwrite(ADC, &readPointer[0], 4);
for(int i=0;i<1000000;i++)
{;}
readPointer[0] = 0x00;
readPointer[1] = 0x00;
readPointer[2] = 0x1A;
readPointer[3] = 0xA0;
spi_readwrite(ADC, &readPointer[0], 4);
//and function defintions
static API_SPI_DEVICE gdevice[] = {{}}; // Global device handler and pointer
static uint8_t gmem[ADI_SPI_INT_MEMORY_SIZE]; // Global use memory
/static uint8_t gpointer[ADC_POINTER] = {0x00, 0x00, 0x01, 0xA0}; // D1, D0, Address, command
static uint8_t readPointer[ADC_POINTER] = {0};
API_SPI_RESULT spi_init(uint8_t device_id)
{
API_SPI_DEVICE *pDevice = &gdevice[device_id];
pDevice->device_id = device_id;
pDevice->instance = true;
if (pDevice->instance != true)
{
return API_SPI_INIT_FAILURE;
}
return API_SPI_SUCCESS;
}
API_SPI_RESULT spi_ADC_cfg(uint8_t device_id, uint16_t clock)
{
API_SPI_DEVICE *pDevice = &gdevice[device_id];
if(pDevice->instance == true)
{
pDevice->device_cfg.clock = clock;
pDevice->device_cfg.data_cfg.pTransmitter = NULL;
pDevice->device_cfg.data_cfg.TransmitterBytes = 0;
pDevice->device_cfg.data_cfg.pReceiver = NULL;
pDevice->device_cfg.data_cfg.ReceiverBytes = 0;
pDevice->device_cfg.dTransfer_Complete = false;
adi_spi_Open(pDevice->device_id, &gmem, ADI_SPI_INT_MEMORY_SIZE, &pDevice->handle);
adi_spi_SetMaster(pDevice->handle, true); // MSB
adi_spi_SetLsbFirst(pDevice->handle, false);
adi_spi_SetHwSlaveSelect(pDevice->handle, false);
adi_spi_SetClock(pDevice->handle, pDevice->device_cfg.clock);
adi_spi_SetTransmitUnderflow(pDevice->handle, false);
adi_spi_SetClockPhase(pDevice->handle, true);
adi_spi_SetClockPolarity(pDevice->handle, false);
adi_spi_SetWordSize(pDevice->handle, ADI_SPI_TRANSFER_32BIT); // if size needs to be large you can use 16bit or 32bit
adi_spi_SetTxWatermark(pDevice->handle, ADI_SPI_WATERMARK_50, ADI_SPI_WATERMARK_DISABLE, ADI_SPI_WATERMARK_DISABLE);
adi_spi_SetRxWatermark(pDevice->handle, ADI_SPI_WATERMARK_50, ADI_SPI_WATERMARK_DISABLE, ADI_SPI_WATERMARK_DISABLE);
adi_spi_SetSlaveSelect(pDevice->handle, ADI_SPI_SSEL_ENABLE1);
adi_spi_RegisterCallback(pDevice->handle, SpiCallback_Master, (void*)pDevice);
return API_SPI_ADC_CFG_SUCCESS;
}
/else
{
return API_SPI_ADC_CFG_FAILURE;
}
}
API_SPI_RESULT spi_readwrite(uint8_t device_id, uint8_t *data, uint32_t data_size)
{
API_SPI_DEVICE *pDevice = &gdevice[device_id];
pDevice->device_cfg.data_cfg.pTransmitter = data;
pDevice->device_cfg.data_cfg.TransmitterBytes = data_size;
pDevice->device_cfg.data_cfg.pReceiver = readPointer;
pDevice->device_cfg.data_cfg.ReceiverBytes = data_size;
adi_spi_SubmitBuffer(pDevice->handle, &pDevice->device_cfg.data_cfg);
while (!pDevice->device_cfg.dTransfer_Complete); // used for transmitting the whole data
pDevice->device_cfg.dTransfer_Complete = false;
printf("Receiver print --> 0x%02x\n",readPointer[0]);
printf("Receiver print --> 0x%02x\n",readPointer[1]);
printf("Receiver print --> 0x%02x\n",readPointer[2]);
printf("Receiver print --> 0x%02x\n\n",readPointer[3]);
return API_SPI_RW_SUCCESS;
}
void SpiCallback_Master(void* pHandle, uint32_t u32Arg, void* pArg)
{
API_SPI_DEVICE *pDevice = (API_SPI_DEVICE *)pHandle;
ADI_SPI_EVENT event = (ADI_SPI_EVENT)u32Arg;
switch (event) {
case ADI_SPI_TRANSCEIVER_PROCESSED:
pDevice->device_cfg.dTransfer_Complete = true;
break;
default:
break;
}
}


Hi Jalipio,
Thank you for your quick replay please, we'll wait for some time.
Regards,
Eswaramoorthy Sugavanam