Cypress技术论坛
直播中

张超

7年用户 1301经验值
私信 关注
[问答]

将EP8定义为OUT会导致软件被卡住

您好!
我试图在我的FX2中定义EP8(使用从FIFO)
但是当我从主机块发送到EP8时,“获取配置DESC”挂起,软件就被卡住了。
如果我不给EP8写信,它就工作了。
这是密码
空隙TDyIIT(空隙)/在启动时调用一次
{
ReVCTL= 0x03;//必须设置ReVCTL 0和ReVCTL 1至1
IFCONFIG=0x43;/ /使用由外部逻辑(5MHz至48 MHz)驱动的IFCK引脚从FIFO
/使用外部FIFO接口引脚驱动外部主机同步
同步延迟;
同步延迟;
EP2CFG= 0xEa;/ /设置EP2有效的In的三(X2)缓冲区,大小为512,体积
同步延迟;
//EP4CFG= 0xE0;/ /设置EP4不有效(EP2)为OUT,散装
EP4CFG=0x00;
同步延迟;
//EP6CFG= 0xE0;//设置EP6有效的IN,批量,512双
EP6CFG=0x00;
同步延迟;
EP8CFG= 0xA0;/ /设置EP8有效的OUT的,散装
同步延迟;
同步延迟;
FIFSET=0x80;/ /重置所有FIFO
同步延迟;
FiPosit=0x02;
同步延迟;
FippET= 0x04;
同步延迟;
FippET= 0x06;
同步延迟;
FippET= 0x08;
同步延迟;
FippET= 0x00;
//这定义了外部接口如下:
同步延迟;
EP2FIFOFFG=0x0d;//这允许FX2自动提交数据包,给出//8bit
同步延迟;
同步延迟;
EP4FIFOCFG=0x05;//这允许FX2自动提交数据包,给出//8bit
同步延迟;
同步延迟;
同步延迟;
EP6FIFOCFG=0x00;//这允许FX2自动提交数据包,给出//8bit
同步延迟;
同步延迟;
EP8FIFOCFG=0x00;//这允许FX2自动提交数据包,给出//8bit
同步延迟;
//发送零长度数据包的能力,
//将从FIFO数据接口设置为8位
同步延迟;
同步延迟;
OutpkDead=0x88;//ARM两个EP2缓冲器“泵”
同步延迟;
OutpkStay= 0x88;
//定义512字节分组的端点,2x缓冲
pFravaSabb=0x00;//定义FLAGA作为PROG级别标志,由FIFOADR[ 1:0]指向
SimcRead;//FLAB作为FIFOADR [1:0]所指的全标志
PFURAGSCDD=0x00;//FLAC为空标志,如FIFOADR指出的[1:0]
FIFOPIN极=0x00;/ /设置所有从FIFO接口引脚为低电平
EP2AutoLunh=0x02;/ /您可以按您的意愿定义这些;
SimCelp;//使FX2自动限制在
EP2AutoLeNLL=0x00;
同步延迟;
//EP8AutoLunh=0x02;/ /您可以按您的意愿定义这些;
//同步延迟;//使FX2自动限制在
//EP8AutoLeNLL=0x00;
//SycCurror;//Outlook端点不POR(上电复位)武装
//SycCurror;//Outlook端点不POR(上电复位)武装
/设置EP2的FIFO可编程电平
//设置为3个包装盒+ 1024×3 + 992=4064(4096个)
/*EP2FIFOFFH=0x1b;
同步延迟;
EP2FIFOFL= 0xE0;*/
EP2FIFOFFH=0x0B;
同步延迟;
EP2FIFOFL= 0xE0;
同步延迟;
同步延迟;
EP1OUTCFG=0xA0;
EP1Cnfg= 0xA0;
同步延迟://OUT端点不POR(上电复位)武装
EP1OUBBC=0x40;//ARM EP1OUT(警告:只有64字节深)
EP1BBC= 0x40;//ARM EP1OUT(警告:只有64字节深)
}

以上来自于百度翻译


     以下为原文
   Hi
    I am trying to define the EP8 as out in my FX2 (using the slave fifo)
    but when i send from the host block to EP8 the 'get config desc' hangs and the software is stuck.
    if i no write to EP8 it works.
    here is the code
     
     
    void TD_Init(void)             // Called once at startup
    {
     
      REVCTL = 0x03; // MUST set REVCTL.0 and REVCTL.1 to 1
      
     IFCONFIG = 0x43; // use IFCLK pin driven by external logic (5MHz to 48MHz) slave fifo
     // use slave FIFO interface pins driven sync by external master
     SYNCDELAY;
     
     
     SYNCDELAY;
     EP2CFG = 0xEA; // sets EP2 valid for IN's  triple(x2) buffer, size 512, bulk
     
     SYNCDELAY;
    // EP4CFG = 0xE0; // sets EP4 not valid (ep2) for out, bulk
     EP4CFG = 0x00;
     
     SYNCDELAY;
    // EP6CFG = 0xE0; // sets EP6 valid for IN's, bulk, 512 double
     EP6CFG = 0x00;
     
     SYNCDELAY;
     EP8CFG = 0xA0; // sets EP8 valid for OUT 's , bulk
     
     
     SYNCDELAY;
      
     SYNCDELAY;
      FIFORESET = 0x80; // reset all FIFOs
     SYNCDELAY;
     FIFORESET = 0x02;
     SYNCDELAY;
     FIFORESET = 0x04;
     SYNCDELAY;
     FIFORESET = 0x06;
     SYNCDELAY;
     FIFORESET = 0x08;
     SYNCDELAY;
     FIFORESET = 0x00;
     SYNCDELAY; // this defines the external interface to be the following:
     SYNCDELAY;
     EP2FIFOCFG = 0x0D; // this lets the FX2 auto commit IN packets, gives the //8bit
     SYNCDELAY;
     SYNCDELAY;
     EP4FIFOCFG = 0x05; // this lets the FX2 auto commit IN packets, gives the//8bit
     SYNCDELAY;
     SYNCDELAY;
     SYNCDELAY;
     EP6FIFOCFG = 0x00; // this lets the FX2 auto commit IN packets, gives the//8bit
     SYNCDELAY;
     SYNCDELAY;
     EP8FIFOCFG = 0x00; // this lets the FX2 auto commit IN packets, gives the//8bit
     SYNCDELAY;
     // ability to send zero length packets,
     // and sets the slave FIFO data interface to 8-bits
     SYNCDELAY;
     
     SYNCDELAY;
     OUTPKTEND = 0x88; // Arm both EP2 buffers to “prime the pump”
     SYNCDELAY;
     OUTPKTEND = 0x88;
     
     // and defines the endpoint for 512 byte packets, 2x buffered
     PINFLAGSAB = 0x00; // defines FLAGA as prog-level flag, pointed to by FIFOADR[1:0]
     SYNCDELAY; // FLAGB as full flag, as pointed to by FIFOADR[1:0]
     PINFLAGSCD = 0x00; // FLAGC as empty flag, as pointed to by FIFOADR[1:0]
     
     FIFOPINPOLAR = 0x00; // set all slave FIFO interface pins as active low
     
     
     
     EP2AUTOINLENH = 0x02; // you can define these as you wish,
     SYNCDELAY; // to have the FX2 automatically limit IN's
     EP2AUTOINLENL = 0x00;
     SYNCDELAY;
     
    // EP8AUTOINLENH = 0x02; // you can define these as you wish,
    // SYNCDELAY; // to have the FX2 automatically limit IN's
    // EP8AUTOINLENL = 0x00;
    // SYNCDELAY; // out endpoints do not POR (power-on reset) armed
     
    // SYNCDELAY; // out endpoints do not POR (power-on reset) armed
     
       // Set the fifo programmable level of EP2
       // Set level to 3 packtes  +  1024*3+992 = 4064 (out of 4096)
      /* EP2FIFOPFH = 0x1B;
       SYNCDELAY;
       EP2FIFOPFL = 0xe0;  */
      
     EP2FIFOPFH = 0x0B;
        SYNCDELAY;
        EP2FIFOPFL = 0xE0;   
     
     
      SYNCDELAY;
      SYNCDELAY;
     
     
        EP1OUTCFG =0xA0;
        EP1INCFG  =0xA0;
     SYNCDELAY; // out endpoints do not POR (power-on reset) armed
      
     
       EP1OUTBC = 0x40;              // arm ep1out (warning: only 64 bytes deep)
       EP1INBC = 0x40;              // arm ep1out (warning: only 64 bytes deep)
    }

回帖(1)

张婷婷

2019-4-26 14:56:04
你好,
您使用的缓冲区配置无效,请通过TRACE1.17 EZ-USB端点缓冲区TRM以获得有效缓冲区配置。
对于一个大容量端点,FIFO缓冲器被设置为512字节,而不是1024字节。根据USB 2规范,一个大容量端点的最大数据包大小限制为512字节,数据传输最大值为512字节。因此,为了保持一致性,FX2LP中的端点大小必须配置为512字节,请查看EP2缓冲区配置。
谢谢
普拉吉斯

以上来自于百度翻译


     以下为原文
    Hi,
      The buffer configuration that you have used is invalid, please go through section 1.17 EZ-USB Endpoint Buffers of TRM for valid buffer configurations.
        For a bulk endpoint the FIFO buffer size needs to be set to 512  bytes and not 1024 bytes. As per  USB 2.0 spec the  maximum packet size of a bulk endpoint is restricted to 512 bytes and  the data is transferred over USB in packets of 512 bytes maximum.  So, in order to maintain  conformity, the endpoint size in the FX2LP must be configured for 512  bytes, please look into EP2 buffer configuration
     
    Thanks 
     
    Prajith
举报

更多回帖

发帖
×
20
完善资料,
赚取积分