完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好!我看到,在USB棒(1024字节块)上连续写操作期间,如果I2C以“并行”方式运行,那么SDA线路突然保持低位,并且不再看到I2C通信……我使用与USB主机(USB Host)一些其他SPI外围设备和具有动态中断驱动程序的I2C-2总线的和谐1.09。他I2C连接的RealtimeCox或我的DSP/DAC似乎被一个I2C操作弄糊涂了。USB写操作只需要37sI,只需要重置硬件或执行以下功能,就可以“重启”它们,执行10次I2C停止“bitban.”,bool I2C_MasterStop_Manual(bool EnableI2C){uint32_t starttime;int i;/*Wait 1BRG*/starttime(ReadCoreTimer();ReadCoreTimer();.(ReadCoreTimer()-启动时间<_BRG_1_BRG_1_TIME_2);/**禁用I2C,如果启用*/PLIB_IIB_II2C_I2C_I2C禁用(I2C_ID 2);//手动执行10x I2C STOP 10STOP STOP STOP(SCL高,然后SDALOLOLO->;HIGH)PLIB PLIB_POIB_PORTS_PORTS_PORTS_PORTS_ID_ID_ID_ID_0,PORTS_ID_ID_ID_ID_0,PORT_CHANNEL_PORT_CHANNEL_S_PinSet(PORTS_ID_0,PORT_CHANNEL_APIN_SCL2;PLIB_PORTS_OpenDrainEn可(PORTS_ID_0,PORT_CHANNEL_F,(1<;<;PIN_SDA2),(PIN_SCL2);;PLIB_PORTS_PORTS_PORTS_PORTS_PORTS_ID ID_0,PORT_PORT_信道_CHANNEL_F,(1<;(1<;<;<;PIN_SDA2(PIN_SCL2);PLIB_POIB_PORTS_PORTS_PORTS_PORTS_PORTS_PORTS_PI端口_Pin方向针针针方向输出输出输出集(PORTS_ID 0,PORTS_ID_ID(i=0;i<10;i++){/*等待2BRG*/启动时间ReadCoreTimer();.(ReadCoreTimer()-starttime
以上来自于百度翻译 以下为原文 Hello ! I saw that during continuous writing actions on a USB Stick (1024 byte blocks) if I2C is runnig in "parallel" suddenly the SDA line stays low and no I2C communication was seen any more... I am using hARMony 1.09 with a USB Host some other SPI peripheral and the I2C-2 bus with dynamic Interrupt driver. The I2C connected realtimeclock or my DSP/DAC seems to be "confused" by an I2C action. The realtime is requeste every 1s. The USB write action needs about 37s I only can bring them "back to live" with hardware reset or a function like below, which executes 10 times I2C STOPs "bit banged". bool I2C_MasterStop_Manual(bool EnableI2C) { uint32_t starttime; int i; /* Wait 1 BRG */ starttime = ReadCoreTimer(); while(ReadCoreTimer()-starttime < BRG_1_TIME_2); /* Disable I2C if enabled*/ PLIB_I2C_Disable(I2C_ID_2); // Manually exectute 10 x I2C STOP (SCL High,then SDA LOW -> HIGH) PLIB_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_A, PIN_SDA2); PLIB_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_A, PIN_SCL2); PLIB_PORTS_OpenDrainEnable(PORTS_ID_0, PORT_CHANNEL_F, (1< PLIB_PORTS_PinDirectionOutputSet(PORTS_ID_0, PORT_CHANNEL_A, PIN_SCL2); for (i=0; i<10; i++) { /* Wait 2 BRG */ starttime = ReadCoreTimer(); while(ReadCoreTimer()- starttime < BRG_1_TIME_2); PLIB_PORTS_PinClear(PORTS_ID_0, PORT_CHANNEL_A, PIN_SDA2); starttime = ReadCoreTimer(); while(ReadCoreTimer()- starttime < BRG_1_TIME_2); PLIB_PORTS_PinClear(PORTS_ID_0, PORT_CHANNEL_A, PIN_SCL2); starttime = ReadCoreTimer(); while(ReadCoreTimer()- starttime < BRG_1_TIME_2); PLIB_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_A, PIN_SCL2); starttime = ReadCoreTimer(); while(ReadCoreTimer()- starttime < BRG_1_TIME_2); PLIB_PORTS_PinSet(PORTS_ID_0, PORT_CHANNEL_A, PIN_SDA2); } PLIB_PORTS_PinDirectionInputSet(PORTS_ID_0, PORT_CHANNEL_A, PIN_SDA2); PLIB_PORTS_PinDirectionInputSet(PORTS_ID_0, PORT_CHANNEL_A, PIN_SCL2); // reenable I2C if (EnableI2C) PLIB_I2C_Enable(I2C_ID_2); return true; } I currently have no real idea why this happens, but I think it's a timing issue because if USB is writing in the main task, the timing is not so stable than without. It seems to happen always on the last byte of the 7 bytes read from the Realtime clock (if it happens). There is NO error in the I2C driver's callback function produced ! void RTC_I2CBufferEventFunction( DRV_I2C_BUFFER_EVENT event, DRV_I2C_BUFFER_HANDLE handle, uintptr_t context) { .... } The software does not really hang, but I never get a "ready" from the USB driver and also no error... Any idea ? |
|
相关推荐
3个回答
|
|
|
|
|
|
哦,对不起,PIC是关于我没有找到的I2C/USB交叉问题的PIC32 MZ2048 EFM100RelaTa。
以上来自于百度翻译 以下为原文 Oh sorry, the PIC is the PIC32MZ2048EFM100 errata about I2C/USB cross problems I did not find. |
|
|
|
或者是这个错误吗?错误情况3:暂停的I2C模块操作(主模式或从模式)——正在进行中的I2C事务在不经意间被挂起而没有出错。但是我只使用了7字节@100kHz。不能。
以上来自于百度翻译 以下为原文 or is it this error ? from errata sheet... False Error Condition 3: Suspended I2C Module Operations (Master or Slave modes) – I2C transactions in progress are inadvertently suspended without error indications. but I'm using only 7 bytes @ 100kHz.. cannot be. |
|
|
|
只有小组成员才能发言,加入小组>>
5178 浏览 9 评论
2003 浏览 8 评论
1931 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3177 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2228 浏览 5 评论
737浏览 1评论
622浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
509浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
636浏览 0评论
533浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-26 17:11 , Processed in 1.530524 second(s), Total 82, Slave 66 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号