Other Parts Discussed in Thread: USB2ANY
hello ti
after write registers, the pll is locked and output correctly. but the content of regiesters can't program int eeprom. after write to EEPROM page1, I read back the content of eeprom, but it is not equal to the content of registers.
becuase th first 4 register are read only, so I didn't program it to the pll.
u32 cdce_regs[]={
//0x00550000 ,
//0x00540000 ,
//0x00530000 ,
//0x00520000 ,
0x00510004 ,
0x00500000 ,
0x004F0008 ,
0x004E1000 ,
0x004D0000 ,
0x004C0188 ,
0x004B8008 ,
0x004AA181 ,
0x00490000 ,
0x00484004 ,
0x00470006 ,
0x00460808 ,
0x0045A181 ,
0x00440000 ,
0x00434004 ,
0x00420006 ,
0x00410808 ,
0x0040A181 ,
0x003F0000 ,
0x003E4004 ,
0x003D0000 ,
0x003C6008 ,
0x003B8008 ,
0x003A502C ,
0x00390000 ,
0x00380005 ,
0x0037001E ,
0x00363400 ,
0x00350069 ,
0x00345000 ,
0x003340C0 ,
0x003207C0 ,
0x00310013 ,
0x003023C7 ,
0x002F0388 ,
0x002E0000 ,
0x002D4F80 ,
0x002C0318 ,
0x002B0051 ,
0x002A0002 ,
0x00290000 ,
0x00280000 ,
0x00270000 ,
0x00260000 ,
0x00250000 ,
0x00240000 ,
0x00230000 ,
0x00220000 ,
0x00210000 ,
0x00200000 ,
0x001F0000 ,
0x001E0064 ,
0x001D0000 ,
0x001C0000 ,
0x001B0004 ,
0x001A0000 ,
0x00190401 ,
0x00180F24 ,
0x00170000 ,
0x00160000 ,
0x00150000 ,
0x00140000 ,
0x00130000 ,
0x00120000 ,
0x001126C4 ,
0x0010921F ,
0x000FA037 ,
0x000E0000 ,
0x000D0000 ,
0x000C0000 ,
0x000B0000 ,
0x000A0000 ,
0x00090000 ,
0x00080000 ,
0x00070C0D ,
0x00060000 ,
0x00050000 ,
0x00040000 ,
0x00030000 ,
0x00020002 ,
0x00012310 ,
0x00003010 ,
};
// 1. Pre-configure the device as desired, except the serial interface using mode.
for(i=0;i<0x52;i++)
{
reg_addr = cdce_regs[i]>>16;
data = cdce_regs[i]&0xffff;
cdce6214_write_reg(reg_addr,data);
xil_printf("write reg%d 0x%x\r\n",reg_addr,data);
Status =cdce6214_read_reg(reg_addr,®_read);
xil_printf("read reg%d 0x%x\r\n",reg_addr,reg_read);
xil_printf("\r\n");
}
cdce6214_read_reg(0x07,®_read);
if((reg_read&1) == 1)
xil_printf("pll is locked\r\n");
else
xil_printf("pll is unlocked\r\n");
// 2. Write 1 to RECAL to calibrate the VCO in this operation mode. R0[4]
cdce6214_write_reg(0,(1<<4)||(1<<12)); //bit4 RECAL, bit12 GPIO1_DIR_SEL
// 3. Select the EEPROM page, to copy the register settings into, using REGCOMMIT_PAGE. R3[9]
cdce6214_write_reg(3,1<<9);//write to page1
// 4. Unlock the EEPROM for write access with EE_LOCK = x5. R15[15:12]
cdce6214_write_reg(15,5<<12);
usleep(1000);
// 5. Start the register commit operation by writing 1 to REGCOMMIT.R3[10]
cdce6214_write_reg(3,(1<<9)||(1<<10));
xil_printf("waiting 100ms to write eeprom\r\n");
usleep(100000);
// 6. Force a CRC update by writing a 1 to UPDATE_CRC. R3[12]
cdce6214_write_reg(3,1<<12);
// 7. Read back the calculated CRC in NVMLCRC.R9
cdce6214_read_reg(9,&nvmscrc);
xil_printf("read reg9 CRC=0x%x\r\n",nvmscrc);
// 8. Store the read CRC value in the EEPROM by writing 0x3F to NVM_WR_ADDR(R13[5:0]) and then the CRC value to NVM_WR_DATA(R14)
cdce6214_write_reg(13,0x3f);
cdce6214_write_reg(14,nvmscrc);
xil_printf("write reg14 CRC=0x%x and waiting 10ms\r\n",nvmscrc);
usleep(10000);
xil_printf("finish writing\r\n");
//eeprom read opertation
void cdce6214_read_eeprom(int addr, u16 *data)
{
cdce6214_write_reg(11,addr);//R11 NVM read address
usleep(50000); //wait 50ms
cdce6214_read_reg(12,data);
}
.....
for(i=40;i<63;i++)
{
cdce6214_read_eeprom(i,&eeprom_data);
xil_printf("eeprom[%d]=%04x\r\n",i,eeprom_data);
}
I found that EEPROM addr 40 is always 0, so I think eeprom write failed, but what wrong with my operation?