This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CDCE6214: eeprom write failed

Part Number: CDCE6214
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,&reg_read);
xil_printf("read reg%d 0x%x\r\n",reg_addr,reg_read);
xil_printf("\r\n");
}

cdce6214_read_reg(0x07,&reg_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?

  • eeprom[40]=0000
    eeprom[41]=00EC
    eeprom[42]=4000
    eeprom[43]=2470
    eeprom[44]=0200
    eeprom[45]=0060
    eeprom[46]=0000
    eeprom[47]=0000
    eeprom[48]=0000
    eeprom[49]=0A22
    eeprom[50]=1800
    eeprom[51]=00D8
    eeprom[52]=0000
    eeprom[53]=0C50
    eeprom[54]=0000
    eeprom[55]=0C50
    eeprom[56]=0000
    eeprom[57]=0D10
    eeprom[58]=0000
    eeprom[59]=1100
    eeprom[60]=0000
    eeprom[61]=0000
    eeprom[62]=0000

  • Xiao,

    Is this programming the EEPROM in your system? Are you able to use an external programming device (USB2ANY) with TICS Pro to program the EVM instead? If so, does the TICS Pro method work?

    Thanks,

    Kadeem

  • yes, this programming is my own system, there is no external  I2c interface in my system, I programed the device by writing the register of cdce6214. so could you please support some example design for reference?

  • Hi Xiao, 
    We don't have any reference designs for this. 

    But please review attached CDCE6214 EEPROM script programming procedure done by TICSpro: 

    import time
    import clr
    clr.AddReference("System.Windows.Forms")
    from System.Windows.Media import SolidColorBrush,Colors,Color,LinearGradientBrush,ColorConverter
    from System.Windows import TextAlignment,VerticalAlignment,FontWeights
    from time import sleep,ctime,clock
    from System.IO import Directory, Path, File
    import re
    from System.Windows.Forms import DialogResult, MessageBox, MessageBoxButtons, MessageBoxIcon,OpenFileDialog,SaveFileDialog
    from INIParser import ConfigFileParser
    from System import Array,Byte
    import datetime
    from math import floor, pow, ceil
    from System.Threading import Thread
    
    global_gui_eeprom_and_reg_data = None         
    gDebug = True
    
    
    def dbg2txt(msg):
        global gDebug
        if gDebug:
            try:
                msg = str(msg)
                strFile = r"TT_debug.log"
                strDir = Path.GetDirectoryName(__file__)
                strFullPath = Path.Combine(strDir, strFile)
                fh = open(strFullPath,"a")
                fh.write(ctime() + "\t" + msg + "\n")
                fh.close()
                fh = None
            except IOError as errdetails:
                UpdateStatusBar("Log File Error: {%1}".format(errdetails.errno, errdetails.strerror))
    
    def BTN_EEP_REGCOMMIT_Update():
        iCRC = ReadParameterAndUpdateUI("nvmlcrc")
        UpdateStatusBar("EEPROM, Register Commit: inital read CRC %i"%iCRC)
        
        if eewriteconfirm(): 
            UpdateStatusBar("EEPROM, Register Commit: disable write protection.")
            ee_lock.iValue = 5; WriteParameter("ee_lock", ee_lock.iValue)
            Thread.Sleep(50)
            UpdateStatusBar("EEPROM, Register Commit: transfer register content.")
    
            regcommit.iValue = 1; WriteParameter("regcommit", regcommit.iValue)   
            
            Thread.Sleep(400)
            if oeimode.iValue == 1:              
                UpdateStatusBar("EEPROM, Register Commit: set interface mode bit.")
                iregc = ReadParameterAndUpdateUI("regcommit_page")
    
                iNVMadr = 16 + iregc * 24                                           
                WriteParameter("nvm_rd_addr", iNVMadr)
                iWork = ReadParameterAndUpdateUI("nvm_rd_data")
                if iWork % 2 == 0:                                                 
                    iWork += 1
                    WriteParameter("nvm_wr_addr",iNVMadr)
                    WriteParameter("nvm_wr_data",iWork)
                    waitonly(0.05)
    
            ReadAllRegisters()
            UpdateStatusBar("EEPROM, Register Commit: refresh CRC.")
            
            update_crc.iValue = 1; WriteParameter("update_crc", update_crc.iValue)  
            check_nvm_busy_time_start = time.clock()
            check_nvm_busy_time_stop = check_nvm_busy_time_start
            is_nvm_busy = ReadParameterAndUpdateUI("nvmbusy")
            while 1 == is_nvm_busy and (check_nvm_busy_time_stop - check_nvm_busy_time_start) < 3:
                check_nvm_busy_time_stop = time.clock()
                is_nvm_busy = ReadParameterAndUpdateUI("nvmbusy")
                
            if 1 == is_nvm_busy:
                UpdateStatusBar("WARNING, after 3 seconds, EEPROM is still busy!  Aborting.")
            else:
                UpdateStatusBar("EEPROM no longer busy.  Done commit.")
            iCRC = ReadParameterAndUpdateUI("nvmlcrc")
            if iCRC == -1:
                UpdateStatusBar("EEPROM, Register Commit: reading CRC from device failed.")
                iCRC = 0 
            else:
                UpdateStatusBar("EEPROM, Register Commit: readback CRC %i" % iCRC)
                
            WriteParameter("nvm_wr_addr", 63)           
            WriteParameter("nvm_wr_data", iCRC)
            
            Thread.Sleep(50)
            
            regcommit.iValue = 0
            update_crc.iValue = 0
            ee_lock.iValue = 10
            UpdateStatusBar("EEPROM, Register Commit: re-enable write protection. Done.")
    
    def BTN_EEP_DIR_WRITE2DEVICE_Update():
        filename = eeselectfile()
        if filename:
            eewritefile(filename)
    
    def BTN_EEP_DIR_READ2FILE_Update():
        dialog = SaveFileDialog()
        dialog.Filter = "All Files (*.*)|*.*|EEPROM HEX Files (*.hxt)|*.hxt"
        dialog.FilterIndex = 2
        dialog.Title = "Export Unit EEPROM to HEX Image"
        if dialog.ShowDialog() == DialogResult.OK:   
            eeprom_and_regs = eeprom_to_eeprom_data()
            if eeprom_and_regs != None:
                dump_string = create_eeprom_dump_string(*eeprom_and_regs)
            
                fh = open(dialog.FileName,"w")
                fh.write(dump_string)
                fh.close()
                
                UpdateStatusBar("EEPROM file saved (" + dialog.FileName+ ")")
            else:
                UpdateStatusBar("Failed to get data to save int (" + dialog.FileName + ")")
        else:
            UpdateStatusBar("EEPROM read aborted (" + dialog.FileName + ")")
        pass
    
    def eeselectfile(open_true_or_save_false=True):
        if open_true_or_save_false:
            dialog = OpenFileDialog()
        else:
            dialog = SaveFileDialog()
        dialog.Filter = "All Files (*.*)|*.*|EEPROM HEX Files (*.hxt)|*.hxt"
        dialog.FilterIndex = 2
        dialog.Title = "Select EEPROM Image"
        if dialog.ShowDialog() == DialogResult.OK:
            return dialog.FileName
            
        return None
    
    def eewritefile(filename):
        if eewriteconfirm():
            waitval = 0.01
            iCRCfromFILE = 0
            iCRC = 0
            UpdateStatusBar("Writing EEPROM File " + filename)
            ee_lock.iValue = 5; WriteParameter("ee_lock", ee_lock.iValue)
            eewait(waitval)
            
            strHXT = ""
            if len(filename) > 4:
                fh = open(filename,"r")
                for line in fh:
                    strHXT = strHXT + line
                fh.close()
                lHXT = re.findall(r'([0-9][0-9])\t0x([0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f])\t([0-9][0-9]*)',strHXT)
                if len(lHXT)==64:
                    liEE = []
                    for i in range(0,64):
                        if len(lHXT[i])==3:
                            liEE.append(int(lHXT[i][1][0:2],16))
                            liEE.append(int(lHXT[i][1][2:4],16))
                        else:
                            dbg2txt('hxt format issue len=' +str(len(lHXT[i])) + ' '+str(lHXT[i]))
                    dbg2txt(str(len(liEE)) +' '+ str(liEE))
                    lCRC = jedec_crc16(liEE,int(lHXT[0][2]),True)
                    dbg2txt("reg2ee calc CRC vs NVMSCRC " + '{:#06x}'.format(lCRC[0]) + ":" + '{:#06x}'.format(lCRC[1]))
                    for i in range(0,64):
                        if len(lHXT[i])==3:
                            WriteParameter("nvm_wr_addr",int(lHXT[i][0]))
                            eewait(waitval)
                            if i==63:
                                iCRCfromFILE = int(lHXT[i][2])
                                WriteParameter("nvm_wr_data",iCRCfromFILE)
                            else:
                                WriteParameter("nvm_wr_data",int(lHXT[i][2]))
                            eewait(waitval)
                else:
                    UpdateStatusBar("HXT File doesn't have 64 words. Canceled.")
                    g.retval = g.retval & False
                eewait(0.1)
                WriteParameter("update_crc",1)
                eewait(waitval)
                iCRC = int(ReadParameter("nvmlcrc"))
                strlivecrc = '{:#06x}'.format(iCRC)
                eewait(waitval)
                UpdateStatusBar("EEPROM written, CRC of FILE / DEVICE / CRCERR " + '{:#06x}'.format(iCRCfromFILE) + " / " + strlivecrc + " / " + '{:#06x}'.format(int(ReadParameter("nvmcrcerr"))))   
        pass
    
    def eewriteconfirm():
        retval = MessageBox.Show("Do you really want to write to the EEPROM?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        if retval == DialogResult.Yes:
            retval = True
        else:
            retval = False
        return retval
    
    def eewait(val):
        retval = 0
        rb = 1
        tDiff = 1
        while rb == 1 and tDiff >= 0.008 and retval > 0:
            tBefore = clock()
            sleep(val)
            rb = int(ReadParameter("nvmbusy"))
            tAfter = clock()
            tDiff = tAfter - tBefore
            retval += 1
        return retval
    
    def waitonly(val):
        retval=0
        tDiff = 0.0000001
        while tDiff <= val:
            tBefore = clock()
            sleep(val)
            tAfter = clock()
            tDiff = tAfter - tBefore
            retval +=1
        return retval
    
    def rbwait(val,bitfield,bUI=True):
        retval=-1
        tDiff = 0.000001
        while tDiff <= val:
            tBefore = clock()
            sleep(val)
            tAfter = clock()
            tDiff = tAfter - tBefore
        if bUI:
            retval = ReadParameterAndUpdateUI(bitfield)
        else:
            retval = ReadParameter(bitfield)
        return retval
    
    def jedec_crc16(lEEPROM,iFileCRC,bCheckFileCRC):
        retval = [-1,-1] 
        ilen = len(lEEPROM)
        if ilen:
            iCRC = 0x0000
            iVal = 0x0000
            iStr = ""
            for i in range(0,ilen-1):       
                iVal = lEEPROM[i] ^ iCRC
                jCRC = 0
                iRST = 0
                iPOL = 0x1021
                iStr = iStr + '{:#06x}'.format(lEEPROM[i])+"\t"+'{:#06x}'.format(iVal) + "\t"
                for j in range(0,16):
                    iRST = MSB(iVal) ^ MSB(jCRC)
                    jCRC = (jCRC <<1 ) & 0xFFFF
                    if iRST:
                        jCRC = jCRC ^ iPOL
                    iVal = iVal << 1
                iCRC = jCRC
                iStr = iStr + str(i)+"\t"+ '{:#06x}'.format(lEEPROM[i])+"\t"+'{:#06x}'.format(iCRC) + "\n"
            retval[0] = iCRC & 0xFFFF
            dbg2txt(iStr)
            if bCheckFileCRC:
                retval[1] = iFileCRC & 0xFFFF
            dbg2txt('JEDEC CRC: ' + '{:#06x}'.format(retval[0]) + ' / '+'{:#06x}'.format(retval[1]))
        else:
            dbg2txt("jedec crc - image length mismatch " + str(len(lEEPROM)))
        return retval
    
    def MSB(val):
        retval = 0
        if val & 0x8000:
            retval = 1
        return retval
    
    def create_eeprom_dump_string(eeb, eep0, eep1, other_regs=None):
        if other_regs:
            lbf, l = other_regs
        else:
            lbf = []
            l = []
        
        
        file_string = "----- CDCE6214-Q1 EEPROM HEX TEXT FILE ------\n"
        file_string += "Header Info\t" + ctime()+"\n"
        ilen = len(l)
        for i in range(0,ilen):
            file_string += lbf[i] + "\t" + '{:#06x}'.format(int(l[i])) +"\n"
        file_string += "\n----- BASE   PAGE 0 ------\n"
        i=0
        for word in eeb:
            file_string += '{:#02d}'.format(i) + '\t' +  '{:#06x}'.format(int(word))+ '\t'+ str(int(word))+'\n'
            i +=1
        file_string += "\n----- CONFIG PAGE 0 ------\n"
        for word in eep0:
            file_string += '{:#02d}'.format(i)+ '\t' +  '{:#06x}'.format(int(word)) + '\t' + str(int(word))+ '\n'
            i +=1
        file_string += "\n----- CONFIG PAGE 1 ------\n"
        for word in eep1:
            file_string += '{:#02d}'.format(i)+ '\t' + '{:#06x}'.format(int(word))+ '\t' +  str(int(word))+ '\n'
            i +=1
        file_string += "----- END EEPROM HEX TEXT FILE ------"
    
        return file_string
    
    
    def bRead_from_NVM_DAT_Update():
        UpdateStatusBar("About to readback nvm_rd_data")
        ReadParameterAndUpdateUI("nvm_rd_data")
    
    def registers_to_eeprom_data():
        return []
    
    def eeprom_to_eeprom_data():
        l = []
        eeb  = []
        eep0 = []
        eep1 = []
        lbf = ["nvmbusy","nvmcrcerr","nvm_wr_error","nvm_rd_error","nvmlcrc","nvmscrc","nvm_rd_addr","nvm_rd_data","nvm_wr_addr","nvm_wr_data"]
        for bf in lbf:
            l.append(ReadParameter(bf))
            
        UpdateStatusBar("Reading EEPROM... please wait.")
        for i in range(0, 16):
            WriteParameter("nvm_rd_addr",i)
            eeb.append(ReadParameter("nvm_rd_data"))
            eewait(0.005) 
        for i in range(16, 40):
            WriteParameter("nvm_rd_addr",i)
            eep0.append(ReadParameter("nvm_rd_data"))
            eewait(0.005) 
        for i in range(40,64):
            WriteParameter("nvm_rd_addr",i)
            eep1.append(ReadParameter("nvm_rd_data"))
            eewait(0.005) 
        UpdateStatusBar("EEPROM read done.")
        
        return (eeb, eep0, eep1, (lbf, l))
    
    
    def bCalc_GUIEE_CRC_Update():
        calc_guieeprom_crc(*global_gui_eeprom_and_reg_data)
    
    def calc_guieeprom_crc(eeb, eep0, eep1, other_regs=None):
        print ("calc_guieeprom_crc")
        try:
            if 64 != len(eeb) + len(eep0) + len(eep1):
                UpdateStatusBar("Error, eeprom data is 64 words long")
                return None
        except:
            UpdateStatusBar("Error, not ready to calculate CRC")
            return None
        
        liEE = []
        for eeprom_page in [eeb, eep0, eep1]:
            for val in eeprom_page:
                liEE.append((val >> 8) & 0xff)
                liEE.append(val & 0xff)
            
        lCRC = jedec_crc16(liEE, eeb[0], True)
        
        UpdateStatusBar("Calcualted CRC as {}".format(lCRC))
        UpdateStatusBar("Calcualted CRC as %04x : %04x" % (lCRC[0], lCRC[1]))
    
    
    def eeprom_data_to_eeprom(eeb, eep0, eep1, other_regs=None):
        if other_regs:
            lbf, l = other_regs
        else:
            lbf = []
            l = []
        waitval = 0.01
        iCRCfromFILE = 0
        iCRC = 0
        UpdateStatusBar("Writing EEPROM")
        ee_lock.iValue = 5; WriteParameter("ee_lock", ee_lock.iValue)
        eewait(waitval)
    
        listEE = []
        listEE.extend(eeb)
        listEE.extend(eep0)
        listEE.extend(eep1)
        
        if len(listEE)==64:
            liEE = []
            for val in listEE:
                liEE.append((val >> 8) & 0xff)
                liEE.append(val & 0xff)
            
            lCRC = jedec_crc16(liEE, listEE[0], True)
            dbg2txt("reg2ee calc CRC vs NVMSCRC " + '{:#06x}'.format(lCRC[0]) + ":" + '{:#06x}'.format(lCRC[1]))
            dbg2txt("reg2ee eeprom_data crc = 0x%x" % listEE[63])
            dbg2txt("reg2ee calculated crc = {}".format(lCRC))
            iCRCfromFILE = listEE[63]
            for i, val in enumerate(listEE):
                WriteParameter("nvm_wr_addr", int(i))
                eewait(waitval)
                WriteParameter("nvm_wr_data", val)
                eewait(waitval)
        else:
            UpdateStatusBar("HXT File doesn't have 64 words. Canceled.")
            g.retval = g.retval & False
            
        eewait(0.1)
        WriteParameter("update_crc",1)
        eewait(waitval)
        iCRC = int(ReadParameter("nvmlcrc"))
        strlivecrc = '{:#06x}'.format(iCRC)
        eewait(waitval)
        UpdateStatusBar("EEPROM written, CRC of FILE / DEVICE / CRCERR " + '{:#06x}'.format(iCRCfromFILE) + " / " + strlivecrc + " / " + '{:#06x}'.format(int(ReadParameter("nvmcrcerr"))))   
    
        ee_lock.iValue = 10;
    
    def eeprom_data_to_file(filename, eeb, eep0, eep1, extra):
        lines = []
        lines.append("CDCE6214-Q1 EEPROM export\n")
        lines.append("Design Name: {}\n".format(tc_DESIGNNAME.sValue))
        lines.append("Design Notes: {}\n".format(mtc_USERNOTES.sValue))
        lines.append(create_eeprom_dump_string(*global_gui_eeprom_and_reg_data))
        
        f = open(filename, "w")
        if f:
            f.writelines(lines)
            UpdateStatusBar("Wrote data to {}".format(filename))
            f.close()
        else:
            UpdateStatusBar("Failed to write to {}".format(filename))
    
    
    
    def file_to_eeprom_data(filename):
        iCRCfromFILE = 0
        iCRC = 0
        UpdateStatusBar("Loading EEPROM File " + filename)
        
        strHXT = ""
        if len(filename) > 4:
            fh = open(filename,"r")
            for line in fh:
                strHXT = strHXT + line
            fh.close()
            lHXT = re.findall(r'([0-9][0-9])\t0x([0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f])\t([0-9][0-9]*)',strHXT)
            if len(lHXT)==64:
                liEE = []
                for i in range(0, 64):
                    if len(lHXT[i]) == 3:
                        liEE.append(int(lHXT[i][1][0:2],16))
                        liEE.append(int(lHXT[i][1][2:4],16))
                    else:
                        dbg2txt('hxt format issue len=' +str(len(lHXT[i])) + ' '+str(lHXT[i]))
                dbg2txt(str(len(liEE)) +' '+ str(liEE))
                lCRC = jedec_crc16(liEE,int(lHXT[0][2]),True)
                dbg2txt("reg2ee calc CRC vs NVMSCRC " + '{:#06x}'.format(lCRC[0]) + ":" + '{:#06x}'.format(lCRC[1]))
                
                eeb = []
                eep0 = []
                eep1 = []
                for i in range(0, 16):
                    if len(lHXT[i])==3:
                        eeb.append(int(lHXT[i][2]))
                    else:
                        UpdateStatusBar("Critical error reading in file.  Should have 3 sets of data at index %d" % i)
                        return False
    
                for i in range(16, 40):
                    if len(lHXT[i])==3:
                        eep0.append(int(lHXT[i][2]))
                    else:
                        UpdateStatusBar("Critical error reading in file.  Should have 3 sets of data at index %d" % i)
                        return False
    
                for i in range(40,64):
                    if len(lHXT[i])==3:
                        eep1.append(int(lHXT[i][2]))
                    else:
                        UpdateStatusBar("Critical error reading in file.  Should have 3 sets of data at index %d" % i)
                        return False
                        
                iCRCfromFILE = int(lHXT[63][2])
                        
            else:
                UpdateStatusBar("HXT File doesn't have 64 words. Canceled.")
                return None
                
            UpdateStatusBar("EEPROM loaded, CRC of FILE: " + '{:#06x}'.format(iCRCfromFILE) )
            return (eeb, eep0, eep1, None)
    
    
    def bREG2GUIEEPROM_Update():
        """
        Convert registers to EEPROM map.
        """
        
        UpdateStatusBar("Creating GUI EEPROM from registers")
        
        eeprom_and_regs = registers_to_eeprom_data()
        
        tp = tics_pro_ini()
        
        global global_gui_eeprom_and_reg_data
        global_gui_eeprom_and_reg_data = eeprom_and_regs
        
        thestr = create_eeprom_dump_string(*eeprom_and_regs)
        mtc_EEPROMdump.sValue = thestr
    
    def bEEPROM2GUIEEPROM_Update():
        """    
        """
        eeprom_and_regs = eeprom_to_eeprom_data()
        eeb, eep0, eep1, extra = eeprom_and_regs
        thestr = create_eeprom_dump_string(eeb, eep0, eep1, extra)
        mtc_EEPROMdump.sValue = thestr
        
        global global_gui_eeprom_and_reg_data
        global_gui_eeprom_and_reg_data = (eeb, eep0, eep1, extra)
        
      
    def bGUIEEPROM2EEPROM_Update():
        if None == global_gui_eeprom_and_reg_data:
            UpdateStatusBar("Load eeprom data first")
        else:
            UpdateStatusBar("Writing EEPROM data to EEPROM")
            eeprom_data_to_eeprom(*global_gui_eeprom_and_reg_data)
    
    def bEXPORT_EEPROM_FILE_Update():
        pass
    
    def bIMPORT_EEPROM_FILE_Update():
        filename = eeselectfile()
        if filename:
            eeb, eep0, eep1, extra = file_to_eeprom_data(filename)
            
            global global_gui_eeprom_and_reg_data
            global_gui_eeprom_and_reg_data = (eeb, eep0, eep1, extra)
    
            thestr = create_eeprom_dump_string(eeb, eep0, eep1, extra)
            mtc_EEPROMdump.sValue = thestr
    
    def bEXPORT_EEPROM_FILE_Update():
        filename = eeselectfile(open_true_or_save_false = False)
        if filename:
            eeprom_data_to_file(filename, *global_gui_eeprom_and_reg_data)
            UpdateStatusBar("Wrote GUI EEPROM data to {}".format(filename))
        
    def bUpdate_ee_status_bits_Update():
        UpdateStatusBar("Updating the 5 controls...")
        ReadParameterAndUpdateUI("nvmcrcerr")
        ReadParameterAndUpdateUI("nvmbusy")
        ReadParameterAndUpdateUI("nvm_rd_error")
        ReadParameterAndUpdateUI("nvmscrc")
        ReadParameterAndUpdateUI("nvmlcrc")
        
        
    

    Use pages 33/34 of CDCE6214 DS on how to program EEPROM: 

    Regards, 

    Vicente 

  • hello vicente

        the script of TICSpro is helpful  but there is still some questions.

    def BTN_EEP_REGCOMMIT_Update():
        iCRC = ReadParameterAndUpdateUI("nvmlcrc")
        UpdateStatusBar("EEPROM, Register Commit: inital read CRC %i"%iCRC)
        
        if eewriteconfirm(): 
            UpdateStatusBar("EEPROM, Register Commit: disable write protection.")
            ee_lock.iValue = 5; WriteParameter("ee_lock", ee_lock.iValue)
            Thread.Sleep(50)
            UpdateStatusBar("EEPROM, Register Commit: transfer register content.")
    
            regcommit.iValue = 1; WriteParameter("regcommit", regcommit.iValue)   
            
            Thread.Sleep(400)
            if oeimode.iValue == 1:              
                UpdateStatusBar("EEPROM, Register Commit: set interface mode bit.")
                iregc = ReadParameterAndUpdateUI("regcommit_page")
    
                iNVMadr = 16 + iregc * 24                                           
                WriteParameter("nvm_rd_addr", iNVMadr)
                iWork = ReadParameterAndUpdateUI("nvm_rd_data")
                if iWork % 2 == 0:                                                 
                    iWork += 1
                    WriteParameter("nvm_wr_addr",iNVMadr)
                    WriteParameter("nvm_wr_data",iWork)
                    waitonly(0.05)
    
            ReadAllRegisters()
            UpdateStatusBar("EEPROM, Register Commit: refresh CRC.")
            
            update_crc.iValue = 1; WriteParameter("update_crc", update_crc.iValue)  
            check_nvm_busy_time_start = time.clock()
            check_nvm_busy_time_stop = check_nvm_busy_time_start
            is_nvm_busy = ReadParameterAndUpdateUI("nvmbusy")
            while 1 == is_nvm_busy and (check_nvm_busy_time_stop - check_nvm_busy_time_start) < 3:
                check_nvm_busy_time_stop = time.clock()
                is_nvm_busy = ReadParameterAndUpdateUI("nvmbusy")
                
            if 1 == is_nvm_busy:
                UpdateStatusBar("WARNING, after 3 seconds, EEPROM is still busy!  Aborting.")
            else:
                UpdateStatusBar("EEPROM no longer busy.  Done commit.")
            iCRC = ReadParameterAndUpdateUI("nvmlcrc")
            if iCRC == -1:
                UpdateStatusBar("EEPROM, Register Commit: reading CRC from device failed.")
                iCRC = 0 
            else:
                UpdateStatusBar("EEPROM, Register Commit: readback CRC %i" % iCRC)
                
            WriteParameter("nvm_wr_addr", 63)           
            WriteParameter("nvm_wr_data", iCRC)
            
            Thread.Sleep(50)
            
            regcommit.iValue = 0
            update_crc.iValue = 0
            ee_lock.iValue = 10
            UpdateStatusBar("EEPROM, Register Commit: re-enable write protection. Done.")

    1. when write 1 to REGCOMMIT bit, should I set bit9 REGCOMMIT_PAGE? because R3 have many bits, I can't access only one bit of R3 register.

    2.   is_nvm_busy = ReadParameterAndUpdateUI("nvmbusy"),  how to access this bit? I could not find the nvm busy flag?

    3.  

     

            regcommit.iValue = 0
            update_crc.iValue = 0
            ee_lock.iValue = 10
            UpdateStatusBar("EEPROM, Register Commit: re-enable write protection. Done.")

         does this code write registers?

    4. I can't uderstand the code below

      if oeimode.iValue == 1:              
                UpdateStatusBar("EEPROM, Register Commit: set interface mode bit.")
                iregc = ReadParameterAndUpdateUI("regcommit_page")
    
                iNVMadr = 16 + iregc * 24                                           
                WriteParameter("nvm_rd_addr", iNVMadr)
                iWork = ReadParameterAndUpdateUI("nvm_rd_data")
                if iWork % 2 == 0:                                                 
                    iWork += 1
                    WriteParameter("nvm_wr_addr",iNVMadr)
                    WriteParameter("nvm_wr_data",iWork)
                    waitonly(0.05)

    above all, those script is quite different from the program said in datasheet 9.5.2.3.1 Register commit flow. 

    In the Register Commit flow, all bits from the device registers are copied into the EEPROM. The recommended
    flow is:
    1. Pre-configure the device as desired, except the serial interface using mode.
    2. Write 1 to RECAL to calibrate the VCO in this operation mode.
    3. Select the EEPROM page, to copy the register settings into, using REGCOMMIT_PAGE. //R3[9]
    4. Unlock the EEPROM for write access with EE_LOCK = x5.
    5. Start the register commit operation by writing 1 to REGCOMMIT. //R3[10],  does this means write_reg(3, 1<<10)?
    6. Force a CRC update by writing a 1 to UPDATE_CRC.
    7. Read back the calculated CRC in NVMLCRC.
    8. Store the read CRC value in the EEPROM by writing 0x3F to NVM_WR_ADDR and then the CRC value to
    NVM_WR_DATA.

  • Hi Xiao, 
    1. Yes, set bit 9 to 1'h given you wish to use page1 of EEPROM. 

    2. Nvmbusy is a bit but it is reserved. 

    3. Yes, it updates crc value register and sets EELOCK to high to prevent accidental programming. 

    4. This puts the device in pin mode which disables I2C interface. The second part is done given once the device is in pin mode you cannot talk to it. It must be directly written through NVMadr/NVMdata.

    Regards, 

    Vicente 

  • but I still don't konw what is wrong with my programing flow,

    function cdce6214_write_reg(reg_address, reg_data) is used to I2C write registers,  I follwed the programing method but failed , can you help me find out  the problem?

  • Hi Xiao, 
    By chance do you have an EVM? I recommend programming the IC on EVM via TICSpro GUI and then transferring the now programmed CDCE6214 to your system.

    Regards, 

    Vicente