完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,在我的项目基于CY7C68013A,我需要不时切换端点EP2的方向从外面到反之,反之亦然。我这样做是通过以下步骤:空隙TDyIIT(空)/在启动时调用{CUCUS= 0x10;//CKSPD[1:0]=10,对于48 MHz操作,禁用CKOUT SimCeldIn;//参见TRM部分15.14 IFCOFIGG= 0xCB;SYNCDELAY;//参见TRM部分15.14 ReVCTL= 0x03;SYNCDELAY;/参见TRM第15节14 / /端点FixPoT=0x80;FiPosie= 0x82. SimcTele:FippET= 0x84:SycCdTrime:FippET= 0x00;SycCdEnter;EP1OutCFG= 0xA0;SYNCDELAY;//参见TRM第15.14节EP1CIFFG=0xA0;SYNCDELAY;/ /参见TRM第15.14节EP2CFG= 0xA2;;//有效,OUT,BULD,512, 2×BuffSycCelp;EP4CFG= 0xA0;/OFF,OUT,BULD,512, 2×Buff同步延迟;EP6CFG= 0x00;/EP8CFG= 0x00;/OutpkDead=0x82};SycCdTrime:OutpkTurnay= 0x82. SycCdTrime;OutpkTurnay= 0x84:SycCdTrime;OutpkTurnay= 0x84. SycCurror;EP2FIFOCFG= 0x18;//AutoIn,自动输出,8位数据总线同步延迟;EP4FIFOCFG=0x00;//手动,8位数据总线同步延迟;/ /为所有EP定义总线宽度=8位(禁用)!)EP6FIFOFFG=0;/8位数据总线同步延迟;EP8FIFOFFG=0;/8位数据总线同步延迟;EP2BCL=0x80;/ARM EP2OUT同步延迟;EP2BCL=0x80;SycCdEnter;EP4BCL=0x80;/ARM EP4OUT同步延迟;EP4BCL=0x80;SYNCDELAY;//标志PrPaGSABA= 0xC8;/FLAB - EP2满;FLAG-A E;用于EP2同步延迟的MPTY;pFrAgCsD=0x04;//FLAGD-PA7;FLAG-PRG。对于EP2同步延迟;FIFOP极性=0x00;SYNCDELAY;//端口D OED=0xFF;//可输出端口D(1输出,0输入)IOD=0x00;}在设备空闲时{无符号char TMP,重复空洞TDyPoLo(空隙)/重复调用;(EP2468 STAT和0x04){TMP=EP4FIFOOBUF〔0〕;OutpkTurn= 0x84;SycCdTrn;OutpkTalk=0x84;SycCdId;IOD= TMP;IF(TMP==0x01)//切换EP2到{SimcDelp;FiPosie= 0x80;SimcDelay;SimcDelay;EP2CFG= 0xE2;;//Healthin,in,Bulk,512, 2×Buff。同步延迟;FiPosit=0x80;FiPosie= 0x82. SycCdTrime:FippET= 0x00;SycCdTrn;IpkTalk=0x82. SimcDelp;IpkTalk=0x82. SycCdEnter;EP2FIFOFFG=0x18;//Autin,AutoOutin,8位数据总线同步延迟;EP2AutoLunh=0x02;SimcDelp;EP2AU;EP2AUToNeLnL= 0x00;Ep2BCH= 0x00;Ep2BCH=0x00;SycCdEnter;Ep2BCL=0;SycCdEnter;EP2BCL=0;SycCdEnter;} //切换EP2到输出{SycCdEnter;EP2CFG=0xA2;//OrthuleUndox,Bulk,512, 2×Buff同步延迟;SycRead;} },因此,我使用EP4(Bulk,OU)T,512x2,手动模式,8位)用于切换EP2(散装,OUT,512X2,自动模式,8位)的方向,同时改变PIN D0的状态以供外部设备使用。我的问题是:为什么在切换到完全标志之后总是变为低电平?
谢谢你的帮助维克托 以上来自于百度翻译 以下为原文 Hi, In my project based on cy7c68013a I need from time to time to switch endpoint EP2 direction from OUT to IN and vise versa. I do it through the following steps: void TD_Init(void) // Called once at startup { CPUCS = 0x10; // CLKSPD[1:0]=10, for 48MHz operation, disable CLKOUT SYNCDELAY; // see TRM section 15.14 IFCONFIG=0xcb; SYNCDELAY; // see TRM section 15.14 REVCTL=0x03; SYNCDELAY; // see TRM section 15.14 //EndPoints FIFORESET=0x80; SYNCDELAY; FIFORESET=0x82; SYNCDELAY; FIFORESET=0x84; SYNCDELAY; FIFORESET=0x00; SYNCDELAY; EP1OUTCFG = 0xA0; SYNCDELAY; // see TRM section 15.14 EP1INCFG = 0xA0; SYNCDELAY; // see TRM section 15.14 EP2CFG=0xa2; //valid, out, bulk, 512, 2 x buff SYNCDELAY; EP4CFG=0xa0; //valid, out, bulk, 512, 2 x buff SYNCDELAY; EP6CFG=0x00; //invalid SYNCDELAY; EP8CFG=0x00; //invalid SYNCDELAY; OUTPKTEND=0x82; SYNCDELAY; OUTPKTEND=0x82; SYNCDELAY; OUTPKTEND=0x84; SYNCDELAY; OUTPKTEND=0x84; SYNCDELAY; EP2FIFOCFG=0x18; //AUTOIN,AUTOOUT,8-bit data bus SYNCDELAY; EP4FIFOCFG=0x00; //manual, 8-bit data bus SYNCDELAY; //to define buswidth==8-bit for all EP (disabled too !!) EP6FIFOCFG=0; //8-bit data bus SYNCDELAY; EP8FIFOCFG=0; //8-bit data bus SYNCDELAY; EP2BCL = 0x80; // arm EP2OUT SYNCDELAY; EP2BCL = 0x80; SYNCDELAY; EP4BCL = 0x80; // arm EP4OUT SYNCDELAY; EP4BCL = 0x80; SYNCDELAY; //Flags PINFLAGSAB=0xc8; //FlagB - Full for EP2; FlagA - Empty for EP2 SYNCDELAY; PINFLAGSCD=0x04; //FlagD - PA7 ; FlagC - Prg. for EP2 SYNCDELAY; FIFOPINPOLAR=0x00; SYNCDELAY; //Port D OED=0xff; //OutputEnable port D (1-output, 0-input) IOD=0x00; } void TD_Poll(void) // Called repeatedly while the device is idle { unsigned char tmp; if(!(EP2468STAT & 0x04)) { tmp=EP4FIFOBUF[0]; SYNCDELAY; OUTPKTEND=0x84; SYNCDELAY; OUTPKTEND=0x84; SYNCDELAY; IOD=tmp; if(tmp==0x01) //switch EP2 to IN { SYNCDELAY; FIFORESET=0x80; SYNCDELAY; SYNCDELAY; EP2CFG=0xe2; //valid, in, bulk, 512, 2 x buff SYNCDELAY; FIFORESET=0x80; SYNCDELAY; FIFORESET=0x82; SYNCDELAY; FIFORESET=0x00; SYNCDELAY; INPKTEND=0x82; SYNCDELAY; INPKTEND=0x82; SYNCDELAY; EP2FIFOCFG=0x18; //AUTOIN,AUTOOUT,8-bit data bus SYNCDELAY; EP2AUTOINLENH=0x02; SYNCDELAY; EP2AUTOINLENL=0x00; EP2BCH=0x00; SYNCDELAY; EP2BCH=0x00; SYNCDELAY; EP2BCL=0; SYNCDELAY; EP2BCL=0; SYNCDELAY; } else //switch EP2 to OUT { SYNCDELAY; EP2CFG=0xa2; //valid, out, bulk, 512, 2 x buff SYNCDELAY; SYNCDELAY; } } } Thus, I use EP4 (BULK, OUT, 512x2, MANUAL MODE, 8-bit) for switching EP2 (BULK, OUT, 512x2, AUTO MODE, 8-bit) direction and at the same time for changing status of pin D0 for its use by external device. My question: why after switching from OUT to IN the FULL FLAG always becomes active (low)? Thank you for your help Victor |
|
相关推荐
3个回答
|
|
嗨,维克托,
我在代码中有两个问题。 1。所使用的端点配置不是有效的配置。请参阅TRM FALID端点配置的第1.18节“EZ-USB端点缓冲器”。 2。为什么你使用EP2作为双向?固件中的端点配置不应与描述符文件中的配置相矛盾。为什么你不能使用另外两个EPS而不是使用EP2作为双向? 以上来自于百度翻译 以下为原文 Hi Victor, I have two concerns in your code. 1. Endpoint configuration that you have used is not a valid configuration. Please go through Section 1.18 "EZ-USB Endpoint Buffers" of TRM for valid endpoint configurations. 2. Why do you use EP2 as bidirectional? Endpoint configuration in firmware shouldn't contradict with the configuration in descriptor file. Why can't you use other two EPs instead of using EP2 as bidirectional? |
|
|
|
您好!
谢谢你的回答 1。现在是有效配置吗? EP2CFG=0xA2;//有效,OUT,散装,512, 2×Buff同步延迟;EP4CFG=0xA0;//有效,OUT,BULD,512, 2×Buff同步延迟;EP6CFG=0x62;/ /无效同步延迟;EP8CFG=0x62;/ /无效同步延迟; 2。关键是我在我的分词装置中没有自由别针来解决两个端点。 以上来自于百度翻译 以下为原文 Hi Thanks for your answer 1. Is it valid configuration now? EP2CFG=0xa2; //valid, out, bulk, 512, 2 x buff SYNCDELAY; EP4CFG=0xa0; //valid, out, bulk, 512, 2 x buff SYNCDELAY; EP6CFG=0x62; //invalid SYNCDELAY; EP8CFG=0x62; //invalid SYNCDELAY; 2. The point is I have not free pins in my pheripheral device for addressing two endpoints |
|
|
|
嗨,维克托,
1。这不是一个有效的配置。您可以使用配置1,E所有EPS有效和双缓冲。 2。如何在EP2和EP4之间进行选择?你有多少个别针? 以上来自于百度翻译 以下为原文 Hi Victor, 1. This is not a valid configuration.You can use configuration1 i,e all EPs as valid and double buffered. 2. How do you select between EP2 and EP4? How many pins you have free? |
|
|
|
只有小组成员才能发言,加入小组>>
752个成员聚集在这个小组
加入小组2071 浏览 1 评论
1827 浏览 1 评论
3642 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1762 浏览 6 评论
1513 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
511浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
362浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
410浏览 2评论
357浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
860浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-26 09:50 , Processed in 0.788878 second(s), Total 52, Slave 45 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号