Microchip
直播中

李淑嘉

7年用户 264经验值
私信 关注
[问答]

I2C驱动程序与DRV I2C BUFFER EVENT ERROR协调挂起

嗨,我已经产生了I2C驱动程序和谐。我需要在EEPROM中连续地在5个不同的位置写入数据。但是我的代码挂在DRVIII2CYBuffRyEngEngError事件中。如果(EEPRODATA.I2CBuffErrase= = DRVIII2CYBuffrEyEngEngRead错误){EEPRODATA.I2CSTATE= EEPROMYI2CYEL错误;}但在调试后向每个位置写入数据后给出断点。在这种情况下,代码不会挂在DRVIII2CYBuffelyEvthyError上,有人能帮我解决这个问题吗?

以上来自于百度翻译


      以下为原文

    hi,

    I have generated I2C driver in hARMony.
    I need to write data in eeprom continuous at 5 different location continuously.
   But my code hangs in DRV_I2C_BUFFER_EVENT_ERROR event.

                  if(eepromData.I2CBufferEvent == DRV_I2C_BUFFER_EVENT_ERROR)
                    {
                       eepromData.i2cStates = EEPROM_I2C_ERROR;
                    }
     But while debugging giving breakpoint after writing data to each location. In this case code doesn't hangs to DRV_I2C_BUFFER_EVENT_ERROR

   can anyone help me with this.......

回帖(14)

张芳

2018-10-22 15:12:59
只有在I2C上看到的错误是当从设备保持SDA低时,建议:在PIC复位时其他设备是否正确复位?如果没有,它可能仍在驱动SDA低。检查范围或仪表。您可能需要时钟SCL,直到其他设备释放SDA。如果其他设备具有单独的电源、电池备份等(DS323 2M数据表对此有注意),也会发生这种情况。

以上来自于百度翻译


      以下为原文

    Only error I saw on I2C was when slave device held SDA low.
Suggest:
- Did other device get properly reset when PIC was reset? If not it may still be driving SDA low. Check with scope or meter. You may need to clock SCL until other device releases SDA. This can also happen if other device has separate power source, battery backup, etc. (DS3232M datasheet has note about this).
 
举报

李铭鑫

2018-10-22 15:27:03
HI,如果试图以太短的间隔多次写入I2C EEPROM,将有:从第二次和后续尝试报告的DRVIII2CYBuffReEngError错误状态值。如果写入I2C EEPROM,则立即尝试从同一EEPROM芯片读取。相同的操作可以尝试L。在一段时间后,I2C EEPROM将再次准备好。迈西尔

以上来自于百度翻译


      以下为原文

    Hi,
If trying to write to I2C EEPROM multiple times with too short interval,
there will be: DRV_I2C_BUFFER_EVENT_ERROR 
status value reported from second and following attempts.
Same if writing to I2C EEPROM, and then immediately trying to read from the same EEPROM chip.
 
The same operation may be tried later, after some time I2C EEPROM will be ready to ansver again.
 
   Mysil
举报

李铭鑫

2018-10-22 15:37:11
重复消息。迈西尔

以上来自于百度翻译


      以下为原文

    Duplicate message.
 
   Mysil
举报

赵丽

2018-10-22 15:52:39
电源是PIC32和EEPROM的常用电源。我给I2C EEPROM写了5次,给出了E.EncDATA.I2CSTATE==EEPROMYI2C2IDLE;而(i(5))if((EEPRODATA.I2CSTATE==EEPROMETII2CYALE))(EEPROMEDATIONI2CSTATE==EEPROMETII2CYSTART){MMESET(EEPROMWORTELCOC,0,40);EEPROMYROC。0);/ / EEPROM EEPROMWORTELCO.[地址]字节EEPROMYROC。字节[0 ];EEPROMWORDELCOC [1 ]=EEPROMETHOROC。字节[1 ];STRCAT(和;EEPROMWORDELCOC(2),“Hello”);EEPROMDEATA.I2CSTATEE= EEPROMYI2C2写;EEPROMYI2C2DATAWAWWRADE();否则,如果(EEPRODATA.I2CSTATE==EEPROMETII2CWAITITX写){ReT1= EEPROMYI2C2DATAWAWRADE();(//trueIf(EEPRODATA.I2cBuffeEngult==DrvII2CyBuffelyEvestRoad完成)//false(EEPRODATA.I2CBuffeEngult==DRVIII2CyBuffrEythEngError错误)如果(ReT1=1){EEPRODATA.I2CSTATE==EEPROMETII2CYIDLE;I++;RIT1=0;}}

以上来自于百度翻译


      以下为原文

    power source is common for PIC32 and EEPROM.
I am writing to I2C EEPROM for 5 times as given below.
eepromData.i2cStates == EEPROM_I2C_IDLE;
while(i<5)
    {
        if((eepromData.i2cStates == EEPROM_I2C_IDLE)||(eepromData.i2cStates==EEPROM_I2C_START))
        {
            memset(EEPROMWriteloc,0,40);
            EEPROM_loc.word=EEPROM_Section(0); //address of eeprom
            EEPROMWriteloc[0]=EEPROM_loc.byte[0];
            EEPROMWriteloc[1]=EEPROM_loc.byte[1];
            strcat(&EEPROMWriteloc[2],"hello");
            eepromData.i2cStates = EEPROM_I2C_WRITE;
            EEPROM_I2C_DATA_WRITE();
        }else if(eepromData.i2cStates == EEPROM_I2C_WAIT_WRITE)
        {
            ret1=EEPROM_I2C_DATA_WRITE();  
//true is if(eepromData.I2CBufferEvent ==DRV_I2C_BUFFER_EVENT_COMPLETE)
//false if(eepromData.I2CBufferEvent == DRV_I2C_BUFFER_EVENT_ERROR)
            if(ret1==1)
            {  
                eepromData.i2cStates == EEPROM_I2C_IDLE;            
                i++;               
                ret1=0;
            }
        }
    }
举报

更多回帖

发帖
×
20
完善资料,
赚取积分