AnsweredAssumed Answered

IIC or I2C SCL issue in s12x Dp512 controller

Question asked by santhosh sl on Aug 26, 2013
Latest reply on Aug 29, 2013 by santhosh sl



I am using S12x DP512 controller for our project.

In this I2C 1 has been configured to be used for getting data from Real Time Clock (ST micro electronics RTC ).

I did Initialization and wrote basic read and write code snippets. I was able to see the expected Pulses coming out of SDA line in sync with SCL.

But RTC expects data to be sent at 400kHz. But I am facing issue in getting this frequency.


I am using S12XDP512 evaluation board and following settings for clock


XCLKS#=0 - Connected

So this should ensure 4Mhz on board


And configured PLL to get 16Mhz as below

  CLKSEL = 0;


   PLLCTL = 177;

/* SYNR: ??=0,??=0,SYN5=0,SYN4=0,SYN3=0,SYN2=1,SYN1=0,SYN0=1 */

  SYNR = 5;                    /* Set the multiplier register */

/* REFDV: ??=0,??=0,REFDV5=0,REFDV4=0,REFDV3=0,REFDV2=0,REFDV1=1,REFDV0=0 */

  REFDV = 2;                   /* Set the divider register */


  PLLCTL = 241;                

   while(!CRGFLG_LOCK);   /* Wait until the PLL is within the desired tolerance of the target frequency */

   /* CLKSEL: PLLSEL=1 */

   CLKSEL = 128;


After this in IIC initialization, I am setting value of

IIC1_IBFD = 0x0B;   /* According to page 401 of controller spec */

this is to divide 16Mhz cpu clock to 400Khz.


But after doing all this I am getting a not seeing 400kh SCL on oscillator. Also the pulses i am seeing on Scope are saw tooth (for any frequency on SCL).

Can you guys help me in getting this 400Khz frequency for SCL.