完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我需要读取超过256字节从一个I2C外围设备在一个单一的传输。
由于CNT变量是UIT8而不是(更有用的)UtiT16,标准组件I2CMY00MasRealDeBuffFe(和)相关联的ISR被限制为256字节。这是在构建级别上看起来不可配置的东西。 我可以创建一个API函数来在本地使用,但是有没有方法可以在我自己的版本中重写ISR,在这里我也可以改变计数器的大小? 以上来自于百度翻译 以下为原文 I need to read more than 256 bytes from an I2C peripheral in a single transfer. The standard component I2CM_0_MasterReadBuf() and associated ISR are limited to 256 bytes due to the cnt variable being uint8 instead of (a more useful) uint16. This is something that does not appear to be configurable at the build level. I can create a copy of the API function to use locally but is there any way to override the ISR in the build with my own version where I can also change the counter size? |
|
相关推荐
1个回答
|
|
我已经解决了这个问题,诀窍在于模式参数I2CMAdMaultRead Buffe()。
我可以把传输分成两个连续的呼叫: 对于第一个模式=I2CyMODENoNOYSTEP, 对于第二种模式=I2CYMODEA重新启动。 然而,目前还不清楚如何在一个没有停止的传输中做两个以上的块,我尝试了连续的中间块,每个设置模式为: I2CI模式重复启动 I2C0MODENYNOYSTOP I2CYMODEA重复启动,I2CYMODENO停止/ *这是你真正想要的工作* 其中第一个在总线上停止,后两个结束在ISR中的CyScript()上。 案例I2CMY00SmithMSTRYRDAADDR:/*在地址被发送后,读取数据*/ …… 其他的 { *由于某些原因没有设置地址阶段:错误*/ IIIF(I2CMY00TimeOutUn启用) /*退出中断以超时计时器来处理此情况** I2CMY00DISABLIN(); I2CMy00CysLink(); 否则 /*块执行流:意外情况*/ CySaRT(0U!= 0U); I.NeNFF/*(I2CMY00TimeOutUnLabVIEW)*/ } 断裂; 幸运的是,512字节对于我的应用来说已经足够了! 以上来自于百度翻译 以下为原文 I have resolved this, the trick is in the mode parameter I2CM_MasterReadBuf(). I was able to split the transfer into two consecutive calls: for the first mode = I2C_MODE_NO_STOP, for the second mode = I2C_MODE_RESTART. However it's not clear how you could do more than two blocks in a transfer without a STOP, I tried consecutive intermediate blocks with each setting mode to: I2C_MODE_REPEAT_START I2C_MODE_NO_STOP I2C_MODE_REPEAT_START | I2C_MODE_NO_STOP /* this is really what you want to work */ The first of these puts a stop on the bus, the latter two end up at the CYASSERT() in the ISR case I2CM_0_SM_MSTR_RD_ADDR: /* After address is sent, read data */ ......... else { /* Address phase is not set for some reason: error */ #if(I2CM_0_TIMEOUT_ENABLED) /* Exit interrupt to take chance for timeout timer to handle this case */ I2CM_0_DisableInt(); I2CM_0_ClearPendingInt(); #else /* Block execution flow: unexpected condition */ CYASSERT(0u != 0u); #endif /* (I2CM_0_TIMEOUT_ENABLED) */ } break; Fortunately < 512 bytes is enough for my application! |
|
|
|
只有小组成员才能发言,加入小组>>
726个成员聚集在这个小组
加入小组1938 浏览 1 评论
1685 浏览 1 评论
3449 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1608 浏览 6 评论
1406 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-6-26 12:26 , Processed in 0.768892 second(s), Total 75, Slave 60 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号