完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,大家好,
我目前正在尝试使用一个1秒的抖动来实现定时器/计数器。 我有以下代码: GPIO配置: CYU3PGPIO复杂配置GPIO复杂配置; CYU3PGPIOCROCKILT GPIOCROCK; GPIOCROC.FASTLKDIV=10; 速度慢=10; SimeDIV= CYU-U3PGGPIOSIMPLE和DIVYBYY2; CKYSRC= CYU-U3PySysLCKYYBYY4; 半英寸=0; ApItReStase= CYU3PGPIOIIT(和GPIOCROCK,GPIOIX中断); APIRESSTAtiON CYU3PDEVICEGPIOORILE(GPIOOTIMER,CyFalse); 如果(ApRestStand)!= CYU-U3PY成功 { PrimeDebug消息(“CYU3PDEVICEGPIOORION \N”); } /IM将一个8kHz方波放入GPIO-TimeTime//这将产生一个中断,每125US GPIO复杂配置.OutValue= CyFLUE; GPIO络合物构型。 GPIO络合物构型 GPIO复杂配置 GPIO络合物构型。 GPIO络合物构型。 GPIO-CONFROCTIONCONTION TIMEMODE = CYU-U3PGPIOTIOR TimeRePOSH边缘; GPIO复杂配置。计时器=0; 每个中断后的GPIO复杂配置 GPIoFieldCopy.Value= 0x000 000 01;/ /产生每125US中断 ApIrtStase= CYU3PGPIOSETFIXONCONFIGG(GPIOOTIMECTONE,和GPIOFIX CONFICOFIG); 如果(ApRestStand)!= CYU-U3PY成功 { PrimeDebug消息(“CYU3PGPIOSETFIXONCONFIG失败:%DN”,APIRSTATION); } GPIO中断回调: 虚空中断(UIT88T GPIOID) { 如果(GPIOID==GPIOOY定时器) { //用于调试的脉冲测试GPIO CYU3PGPIOSET值(TestGPIGO,CyTrue); CYU3PGPIOSET值(TestGPIGO,CyFalse); } } 当我测量出“TestGPIO”的信号时,我观察到125US的脉冲,正如预期的那样。然而,我正在经历20Hz的抖动。 该系统中的其他数据流如下: 1。GPIF到USB(DMA)2。USB到GPIF(DMA) 我想将GPIO中断设置为最高优先级,以确保抖动低于1U。 我尝试使用下面的API函数将GPIO的中断向量设置为最高优先级: CYU3PVITCSET优先级(CyuU3PyVixGPIOIO-COREY向量,0); 然而,抖动仍然存在。 我现在要设置中断的GPIO作为快速中断(FIQ)。你能帮我做这个吗? 当做, 詹姆斯 以上来自于百度翻译 以下为原文 Hi all, I'm currently trying to implement a timer/counter with <1us of jitter. I have the the following code: GPIO CONFIGURATION: CyU3PGpioComplexConfig_t gpioComplexConfig; CyU3PGpioClock_t gpioClock; gpioClock.fastClkDiv = 10; gpioClock.slowClkDiv = 10; gpioClock.simpleDiv = CY_U3P_GPIO_SIMPLE_DIV_BY_2; gpioClock.clkSrc = CY_U3P_SYS_CLK_BY_4; gpioClock.halfDiv = 0; apiRetStatus = CyU3PGpioInit(&gpioClock, GPIO_Interrupt); apiRetStatus = CyU3PDeviceGpioOverride (GPIO_TIMER, CyFalse); if (apiRetStatus != CY_U3P_SUCCESS) { printDebugMessage("CyU3PDeviceGpioOverride failedn"); } // Im putting an 8KHz square wave into GPIO_TIMER // This will generate an interrupt every 125us gpioComplexConfig.outValue = CyFalse; gpioComplexConfig.inputEn = CyTrue; gpioComplexConfig.driveLowEn = CyFalse; gpioComplexConfig.driveHighEn = CyFalse; gpioComplexConfig.pinMode = CY_U3P_GPIO_MODE_STATIC; gpioComplexConfig.intrMode = CY_U3P_GPIO_INTR_TIMER_THRES; gpioComplexConfig.timerMode = CY_U3P_GPIO_TIMER_POS_EDGE; gpioComplexConfig.timer = 0; gpioComplexConfig.period = 0x00000001; // Reset after each interrupt gpioComplexConfig.threshold = 0x00000001; //Generate interrupt every 125us apiRetStatus = CyU3PGpioSetComplexConfig(GPIO_TIMER, &gpioComplexConfig); if (apiRetStatus != CY_U3P_SUCCESS) { printDebugMessage("CyU3PGpioSetComplexConfig failed: %dn",apiRetStatus); } GPIO INTERRUPT CALLBACK: void GPIO_Interrupt(uint8_t gpioId) { if(gpioId == GPIO_TIMER) { // Pulse TEST_GPIO for debug CyU3PGpioSetValue(TEST_GPIO, CyTrue); CyU3PGpioSetValue(TEST_GPIO, CyFalse); } } When I measure the signal coming out of 'TEST_GPIO', I observe pulses at 125us, as expected. HOWEVER I'm experiencing ~20us of jitter. The other data flow in this system is as follows: 1. GPIF to USB (DMA) 2. USB to GPIF (DMA) I want to set the GPIO interrupt to the highest priority, to ensure that the jitter is below 1us. I have tried to use the following API function to set the interrupt vector of the GPIO to the highest priority: CyU3PVicIntSetPriority(CY_U3P_VIC_GPIO_CORE_VECTOR, 0); However, the jitter is still there. I now want to set the interrupt from the GPIO as a fast interrupt (FIQ). Could you please help me with this? Regards, James |
|
相关推荐
3个回答
|
|
你好,
在将硬件引脚设置为所需的逻辑电平之前,CYU3PGPIOStValueValo()API已经有一些延迟。而不是使用这个API,你可以参考KBA 90267,它将指导你如何直接通过寄存器设置GPIO引脚: 在EZ-USB®FX3μ-KBA90267中增加比特敲击GPIO时钟的频率 请试试看,再确认一下。 感谢和问候 阿比纳夫 以上来自于百度翻译 以下为原文 Hi, CyU3PGpioSetValue() API already has some delay before setting the hardware pin to the desired logic level. Instead of using this API you can refer to the KBA 90267 which will guide you how to set GPIO pins through registers directly: Increasing Frequency of Bit-Banged GPIO Clock in EZ-USB® FX3™ - KBA90267 Please try this and confirm. Thanks & Regards Abhinav |
|
|
|
ldliu 发表于 2018-9-24 06:22 嗨,Abhinav, 我已与登记访问你建议实现GPIO的切换。这是减少延迟-但是我真的尽力减少抖动。 我相信这种抖动源是其他中断的系统上运行。为此我要实现GPIO块作为FIQ中断。它不像FIQ处理程序已为SDK定义。如Cyu3VeCursS.Gcc.S. 全局γ-CYU3PFIQHANDER Y-Y-CYU3PFIQHANDER: B-Y-CYU3PFIQHANDER 我已经开始写汇编代码完成FIQ中断处理程序,如下: 全局γ-CYU3PFIQHANDER Y-Y-CYU3PFIQHANDER: STMDB SP!,{R0-R3} RS0 亚LR,LR,α4 STMDB SP!,{R0,R10,R12,LR} BL CYU3PFIQ保存 LDR R1,= CyuU3PyVixAddisS地址 MOV R2,α0 STR R2,[R1] LDR R1,= CyuU3PyVixItIn CythLoad地址 LDR R2,= CyuU3PyVixGPIOIMAGE掩膜 STR R2,[R1] /*“BL Cyu3PrimqnestIn开始*//*!不确定是否需要FIQ。我找不到一个等价的FIQ函数*/ BL CYU3PGPIOC /*“BL Cyu3PrimqNestStutt*//*!不确定是否需要FIQ。我找不到一个等价的FIQ函数*/ LDR R1,= CyuU3PyVixInEnabable地址 LDR R2,= CyuU3PyVixGPIOIMAGE掩膜 STR R2,[R1] CYU3PFIQTraceStur蓄 将GPIO块设置为FIQ: UVTIN 32×T*VixItIn选择StP=((UVTIN 32×T*)(0xFFFFF00 C)); UVTIN 32×T*VixInEnEnable P=((UVTIN 32×T*)(0xFFFFF10 10)); UVTIN 32×T*VixItIn Celmithp=((UVTIN 32×T*)(0xFFFFF1414)); /*禁用GPIO中断*/ * VixItIn Celmithp=VixGPIOH面具; /*设置为FIQ中断*/ * VixIntIn SpultTyp=VixGPIOH掩码; /*启用GPIO中断*/ * VixIntInAbEnLeLp p=VixGPIOH掩码; 我能在这里得到一些帮助吗?在FX3上设置FIQ还有什么关系? 当做, 以上来自于百度翻译 以下为原文 Hi Abhinav, I have implemented the gpio toggle with the register access as you suggested. This does reduce latency - however I'm really trying to reduce the jitter. I believe the source of this jitter is other interrupts which are running on the system. For this reason I want to implement the GPIO Block interrupt as an FIQ. It doesnt look like the FIQ handler has been defined for the SDK. As shown in cyu3vectors_gcc.S: .global __CyU3PFiqHandler __CyU3PFiqHandler: b __CyU3PFiqHandler I have started to write the assembly code to complete the FIQ interrupt handler, as follows: .global __CyU3PFiqHandler __CyU3PFiqHandler: stmdb sp!, {r0-r3} mrs r0, SPSR sub lr, lr, #4 stmdb sp!, {r0, r10, r12, lr} bl CyU3PFiqContextSave ldr r1, =CY_U3P_VIC_ADDRESS_ADDRESS mov r2, #0 str r2, [r1] ldr r1, =CY_U3P_VIC_INT_CLEAR_ADDRESS ldr r2, =CY_U3P_VIC_GPIO_MASK str r2, [r1] /*"bl CyU3PIrqNestingStart*/ /* !!Not sure if needed for FIQ. I cant find an equivalent FIQ function */ bl CyU3PGpioCoreIntHandler /*"bl CyU3PIrqNestingStop*/ /* !!Not sure if needed for FIQ. I cant find an equivalent FIQ function */ ldr r1, =CY_U3P_VIC_INT_ENABLE_ADDRESS ldr r2, =CY_U3P_VIC_GPIO_MASK str r2, [r1] b CyU3PFiqContextRestore Setting the GPIO block as FIQ: uvint32_t *vic_int_select_p = ((uvint32_t *)(0xfffff00c)); uvint32_t *vic_int_enable_p = ((uvint32_t *)(0xfffff0010)); uvint32_t *vic_int_clear_p = ((uvint32_t *)(0xfffff0014)); /* Disable GPIO Interrupt */ *vic_int_clear_p = VIC_GPIO_MASK; /* Set as FIQ Interrupt */ *vic_int_select_p = VIC_GPIO_MASK; /* Enable GPIO Interrupt */ *vic_int_enable_p = VIC_GPIO_MASK; Can I get some assistance here. What else is involved with setting up an FIQ on the FX3? Regards, |
|
|
|
颜刚YanG 发表于 2018-9-24 06:29 你好, 目前,FX3固件的当前实现不处理FiqId中断。你可以在GPIO产生PWM波。请参阅FX3 TRM的第87.4.3节。 感谢和问候 阿比纳夫 以上来自于百度翻译 以下为原文 Hi, Right now current implementation of FX3 firmware doesn't handle FIQ_Interrupt. You can generate PWM wave at GPIO. Refer to the section 8.9.4.3 of FX3 TRM. Thanks & Regards Abhinav |
|
|
|
只有小组成员才能发言,加入小组>>
740个成员聚集在这个小组
加入小组1991 浏览 1 评论
1752 浏览 1 评论
3532 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1683 浏览 6 评论
1459 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
245浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
149浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
343浏览 2评论
289浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
474浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-9-8 20:19 , Processed in 0.901144 second(s), Total 81, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191