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.

Programming CDCE913

Other Parts Discussed in Thread: CDCE913

Hi!

we want to use CDCE913 as the clock for the controller. The  CDCE913 will be synchronised with grid frequency as per  TI Appln. Note SA0088. But unfortunately we are not in position to program the IC. We are trying to program the IC with the TI  DSC , TMS 320 F 28027 , through its I2C port. Can we program in this way. Please advice . We are struggling for last three to four days. If any ready sample source code, any body is having, please do forward.

thanks.

V.S.Deshpande.

  • Hi Vijay,

    The Piccolo devices are capable of I2C control of the CDCE913. There is an app note for the Piccolo describing how to configure the I2C drivers on the device, found here http://www.ti.com/lit/ug/sprufz9d/sprufz9d.pdf.

    The DS of the CDCE913 shows the necessary I2C transactions to occur:

    Table 5 in the DS shows the default I2C addr as 0x65, with the R/W bit as LSB. The command code contains the desired register offset to begin writing to as well as using the MSB as Block vs Byte Read/Write toggle. The byte count is the total # of register to be programmed.

    To program the entire device minus reg0 (ie., Register 0x01 thru 0x1F), the sequence would be as follows:

    • I2C start command
    • Slave Addr + W bit (0xCA as default)
    • Command Code to begin at reg 1 and block write (0x01)
    • Byte Count (0x1F)
    • Data for Reg 1
    • Data for Reg 2
    • etc

    Gabe

  • Hi! 

    as per your advice I tried to load the code  & we observed the Clock & Data simultaneously on the scope. We have given address as 0x65(CA), but when we analysed the waveform observed on the oscilloscope , we are getting th pulses equivalent to address 0x94 & after wards NAC & no further data is going ,as correct address is not going. Can you please study this & advice the reason of this & the corrective measure.

    Thanks & Regards,

    V.S.Deshpande

  • Hi Vijay,

    If the wrong address is being sent, then the Piccolo configuration is wrong. Please confer with the Piccolo E2E forum for proper configuration of your device.

    Thanks!

    Gabe

  • Hi!

    We could finally put the write address  & think that the data is going, because before programming the IC the default frequency is coming 10 MHz. as expected. Across the crystal also we get the oscillations of same frequency. But when we programm all the outputs Y1,Y2,Y3 goes low. There are no oscillations. Also the oscillations across the crystal vanish.we are using KDS SMD 49 crystals. Can you please guide us any further action. We are really very thankful to you for the help extended.

    V.S.Deshpande

  • HI Vijay,

    Could you provide us with a register configuration file or a desired configuration?

    Gabe

  • Hi!

    The register details used are as follows:

    /*
     * main.c
     */
    
    #include "DSP28x_Project.h"
    
    
    struct I2C_Data {
    	int count;
    	char msg[8];
    };
    
    int Start_Programming,i ,j;
    struct I2C_Data dat;
    interrupt void xint1_isr(void);
    
    void I2CA_Init(void);
    void I2CA_WriteData(struct I2C_Data *ptr);
    void I2ca_create_Byte(struct I2C_Data *ptr, char ch);
    
    extern Uint16 RamfuncsLoadStart;
    extern Uint16 RamfuncsLoadEnd;
    extern Uint16 RamfuncsRunStart;
    
    void main(void) {
    	 Start_Programming = 0;
    	// Step 1. Initialize System Control:
    	   InitSysCtrl();
    
    	   EALLOW;
    
    	   GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 0;
    	   GpioCtrlRegs.GPAQSEL2.bit.GPIO19 = 2;
    	   GpioCtrlRegs.GPADIR.bit.GPIO19 = 0;
    	   GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0;
    
    	   GpioIntRegs.GPIOXINT1SEL.bit.GPIOSEL = 19;   // XINT1 is GPIO19
    
    	   EDIS;
    
    	   InitI2CGpio();
    
    	   EALLOW;
    	     SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
    	   EDIS;
    
    	   EALLOW;
    	      SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
    	   EDIS;
    
    	   // Step 3. Clear all interrupts and initialize PIE vector table:
    	   // Disable CPU interrupts
    	      DINT;
    
    	   // Initialize the PIE control registers to their default state.
    	   // The default state is all PIE interrupts disabled and flags
    	   // are cleared.
    	      InitPieCtrl();
    
    	   // Disable CPU interrupts and clear all CPU interrupt flags:
    	      IER = 0x0000;
    	      IFR = 0x0000;
    
    	   // Initialize the PIE vector table with pointers to the shell Interrupt
    	   // Service Routines (ISR).
    	   // This will populate the entire table, even if the interrupt
    	   // is not used in this example.  This is useful for debug purposes.
    	   // The shell ISR routines are found in DSP2802x_DefaultIsr.c.
    	   // This function is found in DSP2802x_PieVect.c.
    	      InitPieVectTable();
    
    	      XIntruptRegs.XINT1CR.bit.POLARITY = 0;      // Falling edge interrupt
    	      XIntruptRegs.XINT1CR.bit.ENABLE = 1;        // Enable XINT1
    
    	      EALLOW;  // This is needed to write to EALLOW protected registers
    	      	  PieVectTable.XINT1 = &xint1_isr;
    	      EDIS;    // This is needed to disable write to EALLOW protected registers
    
    	      IER |= M_INT1;
    
    	      PieCtrlRegs.PIEIER1.bit.INTx4 = 1;
    
    	      // Enable global Interrupts and higher priority real-time debug events:
    	      EINT;   // Enable Global interrupt INTM
    	      ERTM;   // Enable Global realtime interrupt DBGM
    
    	      I2caRegs.I2CSAR = 0x65;	// 0xE5;		//0xCA;
    
    	      for(;;)
    	      {
    	    	  I2CA_Init();
    
    	    	  if(Start_Programming == 1)
    	    	  {
    	    		  for (i = 0; i < 500; i++)
    	    		  		  for (j = 0; j < 500; j++);
    
    	    		  Start_Programming = 0;
    
    	    		  I2ca_create_Byte(&dat, 0x65);		//0xCA);		//ADD
    
    	    		  I2ca_create_Byte(&dat, 0x01);		//CMD
    	    		  I2ca_create_Byte(&dat, 0x1F);		//COUNT
    
    	    		  I2ca_create_Byte(&dat, 0x02);		//01
    	    		  I2ca_create_Byte(&dat, 0xB7);		//02
    	    		  I2ca_create_Byte(&dat, 0xE8);		//03
    	    		  I2ca_create_Byte(&dat, 0x02);		//04
    	    		  I2ca_create_Byte(&dat, 0x50);		//05
    	    		  I2ca_create_Byte(&dat, 0x40);		//06
    	    		  I2ca_create_Byte(&dat, 0x00);		//07
    	    		  I2ca_create_Byte(&dat, 0x00);		//08
    	    		  I2ca_create_Byte(&dat, 0x00);		//09
    	    		  I2ca_create_Byte(&dat, 0x00);		//0A
    	    		  I2ca_create_Byte(&dat, 0x00);		//0B
    	    		  I2ca_create_Byte(&dat, 0x00);		//0C
    	    		  I2ca_create_Byte(&dat, 0x00);		//0D
    	    		  I2ca_create_Byte(&dat, 0x00);		//0E
    	    		  I2ca_create_Byte(&dat, 0x00);		//0F
    	    		  I2ca_create_Byte(&dat, 0x00);		//10
    	    		  I2ca_create_Byte(&dat, 0x00);		//11
    	    		  I2ca_create_Byte(&dat, 0x00);		//12
    	    		  I2ca_create_Byte(&dat, 0x00);		//13
    	    		  I2ca_create_Byte(&dat, 0x6D);		//14
    	    		  I2ca_create_Byte(&dat, 0x02);		//15
    	    		  I2ca_create_Byte(&dat, 0x64);		//16
    	    		  I2ca_create_Byte(&dat, 0x05);		//17
    	    		  I2ca_create_Byte(&dat, 0xFF);		//18
    	    		  I2ca_create_Byte(&dat, 0xA0);		//19
    	    		  I2ca_create_Byte(&dat, 0x02);		//1A
    	    		  I2ca_create_Byte(&dat, 0x84);		//1B
    	    		  I2ca_create_Byte(&dat, 0x00);		//1C
    	    		  I2ca_create_Byte(&dat, 0x40);		//1D
    	    		  I2ca_create_Byte(&dat, 0x02);		//1E
    	    		  I2ca_create_Byte(&dat, 0x08);		//1F
    
    	    	  }
    
    	      }
    
    }
    
    void I2CA_Init(void)
    {
    	I2caRegs.I2CSAR = 0x65;	//0xE5;		//0xCA;
    
    	I2caRegs.I2CPSC.all = 5;       // Prescaler - need 7-12 Mhz on module clk
    	I2caRegs.I2CCLKL = 45;           // NOTE: must be non zero
    	I2caRegs.I2CCLKH = 45;            // NOTE: must be non zero
    
    	I2caRegs.I2CMDR.all = 0x0020;    // Take I2C out of reset
    
    	I2caRegs.I2CFFTX.all = 0x6000;   // Enable FIFO mode and TXFIFO
    	I2caRegs.I2CFFRX.all = 0x2040;   // Enable RXFIFO, clear RXFFINT,
    
    	return;
    }
    
    void I2CA_WriteData(struct I2C_Data *dat)
    {
    	int i, j;
    
    	I2caRegs.I2CCNT = dat->count;
    
    	for (j = 0; j < dat->count; j++)
           I2caRegs.I2CDXR = dat->msg[j];
    
    	for (i = 0; i < 50; i++)
    		  for (j = 0; j < 50; j++);
    
        // Send start as master transmitter
       I2caRegs.I2CMDR.all = 0x6E20;
       return;
    }
    
    void I2ca_create_Byte(struct I2C_Data *ptr, char ch)
    {
    	char Value;
    	int i, j;
    	ptr->count = 8;
    	Value = ch;
    
    		ptr->msg[0] = Value;
    		ptr->msg[1] = Value;
    		ptr->msg[2] = Value;
    		ptr->msg[3] = Value;
    		ptr->msg[4] = Value;
    		ptr->msg[5] = Value;
    		ptr->msg[6] = Value;
    		ptr->msg[7] = Value;
    
    	I2CA_WriteData(ptr);
    
    	for (i = 0; i < 100; i++)
    	  for (j = 0; j < 100; j++);
    }
    
    interrupt void xint1_isr(void)
    {
    	Start_Programming = 1;
    
    	// Acknowledge this interrupt to get more from group 1
    	PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
    }
    

    Regards and Thanks in advance!

  • Hi Richa,

    Thanks for posting the total code on the e2e, Clocks & Timer community. Hoping to get solution from TI Team

    V.S.Deshpande