RT , 按照AD 官方手册,板子也是用的官方评估板的原理图,采用SPI 串行接口,主要初始化程序如下,没有其他操作,但是I Q就是没有波形输出,但是有一 100mv 左右的直流电压(50欧负载电阻),
void AD9854_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
SPI_InitTypeDef SPI_InitStructure;
RCC_PCLK2Config(RCC_HCLK_Div2);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOD | RCC_APB2Periph_SPI1, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
GPIO_InitStructure.GPIO_Pin = SDIO_Pin | SCLK_Pin;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = CS_Pin;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = SDO_Pin;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = IORST_Pin | PMD_Pin | RESET_Pin | UDCLK_Pin;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOD, &GPIO_InitStructure);
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_128;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_Init(SPI1, &SPI_InitStructure);
SPI_CalculateCRC(SPI1, DISABLE);
SPI_Cmd(SPI1, ENABLE);
/* set ad9854 serial mode (pin connect to GND)*/
PMD_LOW();
/* reset ad9854 upon power-up (at leaset 10 clk cycles) */
UDCLK_LOW();
RESET_LOW();
IORST_LOW();
AD9854_delay(0xf);
RESET_HIGH();
AD9854_delay(0xff);
RESET_LOW();
/* ad9854 control register */
AD9854_delay(10);
CS_LOW();
AD9854_SendData(0x00); //address
AD9854_SendData(0x00);
AD9854_SendData(0xc1);
AD9854_SendData(0x00);
AD9854_SendData(0x01);
CS_HIGH();
/* update */
UDCLK_HIGH();
AD9854_delay(0x2f);
UDCLK_LOW();
/* update clk */
//CS_LOW();
//AD9854_SetUDClk(0xfffffff);
//CS_HIGH();
/* ad9854 phase */
/*CS_LOW();
AD9854_SetPha(0, 0x00ff);
AD9854_SetPha(1, 0x00ff);
CS_HIGH();
*/
/* ad9854 freq ftw = (Fhz * 2^48/sysclk(300M)) */
while(1){
CS_LOW();
AD9854_SetFrq(2,12345678);
//AD9854_SetFrq(3,0x0fffffff);
CS_HIGH();
AD9854_delay(10);
UDCLK_HIGH();
AD9854_delay(0x10);
UDCLK_LOW();
}
}
感觉是没法向 AD9854 写入数据,而且电源电路大概 50ma,芯片不发烫,说明没有工作,排除芯片烧坏的情况下还有哪些可能呢,程序大致如上,需要修改麽??
此帖出自
小平头技术问答
一周热门 更多>