完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,大家好,
我需要创建一个具有更好分辨率的定时器,然后是FX3上的1U。 我遵循下面的链接在一个复杂的GPIO上创建一个0.1US定时器:如何用FX3- KBA22034获得一个0.1秒的单位时间戳。 但是,当我使用CYU3PGPIOXION SAMPrPulWOW()时,它看起来不太准确。 例如: CYU3PGPIO复合SAMPLIOWO(57,和Testa); CYU3PGPIO复合SAMPLIONW(57,和TESTB); 这给出了~3U的时间差,这似乎太长了。CyU3PGPIOXION SAMPrPult OW()是否是一个慢函数? 我也曾试过就直接阅读通用IO寄存器。IO引脚的定时器/计数器登记有“0xe0001004的基地址。这是一个特殊的GPIO。我怎么能读IO引脚GPIO 57定时器/计数器登记地址,我用什么做的? 总结: 1。有在Fx3 0.1us分辨率计数准确的方法 2。对IO引脚GPIO 57定时器/计数器登记地址是什么 谢谢 以上来自于百度翻译 以下为原文 Hi all, I need to create a timer which has better resolution then 1us on the FX3. I have followed the following link to create a 0.1us timer on a complex gpio: How to Get a 0.1-µs Unit Timestamp with FX3 – KBA220034 However when I use CyU3PGpioComplexSampleNow() it doesnt seem very accurate. For example: CyU3PGpioComplexSampleNow (57, &testa); CyU3PGpioComplexSampleNow (57, &testb); This gives a time difference of ~3us which seems too long. Is the CyU3PGpioComplexSampleNow() a slow function? I have also tried just reading directly from the general purpose IO registers. The io pin timer/counter register has a base address of '0xE0001004'. This is for one particular GPIO. How can I read the io pin timer/counter register for GPIO 57, what address do I use? To summarise: 1. Is there an accurate way to count at 0.1us resolution on the FX3 2. What is the address of the io pin timer/counter register for GPIO 57 Thanks |
|
相关推荐
2个回答
|
|
嗨,杰姆斯,
你说的API速度慢是对的。这是可以克服的方法是直接从寄存器中读取您所建议的。 FX3 API的源代码存在于SD:C:程序文件(x86) CyPress EZ-USB FX3SDK 1.3固件 FX3YSDK11Y3Y3SR.zip。 此API的源程序存在于CyU3GPIoFiely.C文件中。您可以找出正在读取哪个寄存器,以及如何使用代码的最后一部分。 在源代码中,您可以注意到“index”参数。在你的情况下是1(对于GPIO 57)。 API的最后一部分有这个重要的代码: *现在将模式设置为样本。等待采样 *完成并从阈值寄存器读取值。*/ GPIO-GT;LPPGPIOPIN PIN [索引]。 (CYU-U3PGPIOOMMODEA SAMPPLIONWOR&LT;和CYUU3PYLPPGPIOHYMODEPOS POS); 同时(GPIO-GT;LPPG-GPIOPIN PIN [索引]。状态和CYUU3PYLPPGPIOOYMODEMODEM屏蔽); * ValuePyp= GPIO-GT;LPPG-GPIOPIN PIN [索引]阈值; 这里,GPIO-GT;LPPH-GPIOPIPIN [索引]。状态将是索引1(GPIO 57)的0xE000 01010。 GPIO-GT;LPPH-GPIOPIN PIN [索引]。阈值将为索引1(GPIO 57)的0xE000 0101C。 当做, -马杜 以上来自于百度翻译 以下为原文 Hi James, You are right about the API being slow. The way this can be overcome is to directly read from the register as you suggested. The source code of the FX3 APIs is present in the SDK in "C:Program Files (x86)CypressEZ-USB FX3 SDK1.3firmwarefx3_sdk_1_3_3_src.zip" The source of this API is present in cyu3gpiocomplex.c file. You can find out which register is being read and how and just use the last part of the code. In the source code, you can notice the "index" parameter. It is 1 in your case (for GPIO 57). The last part of the API has this important code: /* Set the mode to sample now. Wait for the sampling to * complete and read the value from the threshold register. */ GPIO->lpp_gpio_pin[index].status = (regVal | (CY_U3P_GPIO_MODE_SAMPLE_NOW << CY_U3P_LPP_GPIO_MODE_POS)); while (GPIO->lpp_gpio_pin[index].status & CY_U3P_LPP_GPIO_MODE_MASK); *value_p = GPIO->lpp_gpio_pin[index].threshold; Here, GPIO->lpp_gpio_pin[index].status will be 0xE0001010 for index 1 (gpio 57). GPIO->lpp_gpio_pin[index].threshold will be 0xE000101C for index 1 (gpio 57). Regards, -Madhu |
|
|
|
dfzvzs 发表于 2018-9-29 10:02 嗨,Madhu, 查看源代码有阻塞的cyu3pgpiocomplexsamplenow()环: *现在将模式设置为样本。等待采样 *完全从门槛登记阅读价值。*/ GPIO - >;lpp_gpio_pin [索引]。状态=(regval | (cy_u3p_gpio_mode_sample_now <;<;cy_u3p_lpp_gpio_mode_pos)); 而(GPIO - >;lpp_gpio_pin [索引]。地位&;cy_u3p_lpp_gpio_mode_mask); * value_p = GPIO - >;lpp_gpio_pin [索引]。阈值; 我相信这是这个API调用相关的延迟源。即使改写API调用平登记访问,还需要~ 2.5us完成。 我们需要能够测量事件到100ns精度之间的时间。我们如何能达到与FX3? 当做, 詹姆斯 以上来自于百度翻译 以下为原文 Hi Madhu, Looking into the source code there is a blocking loop in the CyU3PGpioComplexSampleNow(): /* Set the mode to sample now. Wait for the sampling to * complete and read the value from the threshold register. */ GPIO->lpp_gpio_pin[index].status = (regVal | (CY_U3P_GPIO_MODE_SAMPLE_NOW << CY_U3P_LPP_GPIO_MODE_POS)); while (GPIO->lpp_gpio_pin[index].status & CY_U3P_LPP_GPIO_MODE_MASK); *value_p = GPIO->lpp_gpio_pin[index].threshold; I believe this is the source of the latency associated with this API call. Even after rewriting the API call with plain register accesses, it still takes ~2.5us to complete. We need to be able to measure time between events to 100ns accuracy. How can we achieve this with the FX3? Regards, James |
|
|
|
只有小组成员才能发言,加入小组>>
754个成员聚集在这个小组
加入小组2100 浏览 1 评论
1846 浏览 1 评论
3664 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1782 浏览 6 评论
1532 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
556浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
410浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
433浏览 2评论
379浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
905浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-18 22:51 , Processed in 1.037675 second(s), Total 100, Slave 84 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号