AnsweredAssumed Answered

Data clocking problem

Question asked by lehouillier.james on Mar 21, 2013
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++;
            }
#ifdef EAP_DEBUG
            printf("StartBit_flag = %d\n", StartBit_flag);
            StartBit_flag = 0;
#endif
            ++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;
            

Outcomes