cancel
Showing results for 
Search instead for 
Did you mean: 

Data clocking problem

jameslehouillier9
Associate
Posted on March 21, 2013 at 20:49

Can anybody help explaint why when as the Master on the i2c, when i send out the slave address for a read request, i get 2 consecutive 9 cycle clock bursts before I try to do the Read. Basically i am loosing the first 2 data bytes being transmitted because they were not asked for yet. As soon as I start to execute case 14 below is when i get the bursts. I am in doing in that line of code is checking the status of the address send.

Code segment:

        case 11:

            I2C_GenerateSTART(I2C1, ENABLE);

            ++i_state;

            break;

            

        case 12:

            while(!I2C_GetFlagStatus(I2C1, I2C_FLAG_SB))

            {

                StartBit_flag++;

            }

&sharpifdef EAP_DEBUG

            printf(''StartBit_flag = %d\n'', StartBit_flag);

            StartBit_flag = 0;

&sharpendif

            ++i_state;

            break;

            

        case 13:  

            I2C_Send7bitAddress(I2C1, RTC_I2C_ADDRESS , I2C_Direction_Receiver);   

            ++i_state;

            break;

            

        case 14:  

           if(I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED))  

            {

                ++i_state;

            }

            else

            {

               Busy_flag++;

               printf(''Busy flag case 14 = %d\n'', Busy_flag );

               break;

            }

            printf(''Send_address success\n'');

            

            ++i_state;

            break;

            

#i2c
0 REPLIES 0