cancel
Showing results for 
Search instead for 
Did you mean: 

I2C clock is not generated

sr_shinde
Associate II
Posted on September 25, 2009 at 04:24

I2C clock is not generated

3 REPLIES 3
sr_shinde
Associate II
Posted on May 17, 2011 at 09:57

Hi all

I am not able to get clock on I2C clock out line

I have done following configuration

SCU_APBPeriphClockConfig(__I2C0,ENABLE);

SCU_APBPeriphClockConfig(__GPIO2, ENABLE);

SCU_APBPeriphReset(__I2C0, DISABLE);

SCU_APBPeriphReset(__GPIO2, DISABLE);

I2C_Cmd (I2C0, ENABLE);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 ;

//GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;

//GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;

//GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull;

GPIO_InitStructure.GPIO_Type = GPIO_Type_OpenCollector;

GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Enable;

//GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Disable;

GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt2;

GPIO_Init(GPIO2, &GPIO_InitStructure);

/* I2C0 Configuration */

//I2C_StructInit(&I2C_InitStructure);

I2C_InitStructure.I2C_GeneralCall = I2C_GeneralCall_Disable;

//I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;

I2C_InitStructure.I2C_Ack = I2C_Ack_Disable;

I2C_InitStructure.I2C_CLKSpeed = 400000;

I2C_InitStructure.I2C_OwnAddress = 0xA0;

I2C_Init(I2C0, &I2C_InitStructure);

Uart0printf(''GO'');

I2C_GenerateStart (I2C0, ENABLE);

// Test on EV5 and clear it

while( ! I2C_CheckEvent(I2C0, I2C_EVENT_MASTER_MODE_SELECT) );

Uart0printf(''Start1 Generated'');

while(1)

{

//Uart0printf(''S'');

I2C_SendData (I2C0, 0xAF);

while (!I2C_GetFlagStatus (I2C0, I2C_FLAG_BUSY));

}

OUTPUT:

''GOStart1 Generated'' Displayed on UART.

Clock not received( Observed on CRO ) on I2C ClockOut when data byte is sent

Is there any mistake in code written by me,please let me know.

Regards

Sai

[ This message was edited by: sr_shinde on 05-03-2009 04:51 ]

sr_shinde
Associate II
Posted on May 17, 2011 at 09:58

Sorry for late response.

I dont recollect the problem.

But now I am using the same configuration and its working fine.

I guess there was hardware problem.

So please chech out with hardware ( I/O pins ).

Regards

Sai

fred_blais5
Associate II
Posted on May 17, 2011 at 09:58

Have you solved the problem? I've got the same trouble!