Cypress技术论坛
直播中

杜文渊

8年用户 203经验值
私信 关注
[问答]

FX2LP没有重置

我有一个问题与FX2LP USB设备不重新启动后,我的Linux基于LIB总线的应用程序已被杀死CTL C在数据传输。
似乎USB总线正在消失,而电源仍然被应用(我的设备是使用外部电源)。
只有通过对Pulver-Curror进行恢复,才能使设备循环。
解决这个问题的正确途径是什么?
我实现了一个肮脏的把戏在FX2的固件可以解决这个问题:
我实现了一个用户命令(vx_11)调用所有的方法,实现td_init()(见代码贝娄)。
然后我打电话给该用户的命令在设备开启相位(在libu***驱动)。
空隙TDyIIT(空隙)/在启动时调用一次
{
初始化文件包();
}
启动时空启动板(空隙)/调用一次
{
CPUCs=0x10;//CkkSPD[1:0]=10,用于48 MHz操作
IFCONFIG=0xE3;


}
//用户命令:
BoOL Dr.VundMcNordNod(Valm)
{


案例VXY11:
初始化文件包();
断裂;
}
因为某些原因,我不太明白,我要把这两次用户命令否则公交还是死了。
我相信有更好的/干净的方法来解决这个问题。
注:CyPress芯片的复位引脚连接到VCC。
谢谢,malik cisse

以上来自于百度翻译


     以下为原文
   I have an issue with a FX2LP USB device not restarting after my linux-libu*** based application has been killed with Ctl-c during data transfer.
    It seems that the USB bus is going away while power is still applied (My device is using external power supply).
    Only powercycling the device by replugging powwer cable helps.
    What is the right way to solve this issue?
     
    I implemented a dirty trick in the FX2 firmware that seems to solve the problem:
    I implemented a user command (VX_11) that calls all the rutines implemented in TD_Init() (see code bellow).
    I then call this user command in the device opening phase (in the libu*** driver).
    void TD_Init(void) // Called once at startup
    {
     initialize_board();
    }
     
    void initialize_board(void) // Called once at startup
    {
     CPUCS = 0x10;                 // CLKSPD[1:0]=10, for 48MHz operation
     
     IFCONFIG = 0xE3;
     ...
     ...
    }
     
    //user command:
    BOOL DR_VendorCmnd(void)
    {
    ...
    ...
    case VX_11:
     initialize_board();
     break;
    }
     
    For some reason I don't quite understand, I need to send this user command twice otherwise the bus is still dead.
    I am sure there is a better/clean way to solve this issue.
    Note: The reset pin of the cypress chip is connected to VCC.
    Thanks, malik cisse

回帖(13)

徐非姗

2019-3-20 10:16:24
嗨,马利克,我想还有另外一种方法。这里你可以做的是实现一个将重新枚举你的设备的供应商命令。您可以使用下面的代码来执行:“CaseVRYReNUM:*EP0BUF=7;EP0BCH=0;EP0BCL=1;//ARM端点,用字节传送EP0CS=BMHSNAK;/ /确认设备请求EZUBSULD延迟(1000)的握手阶段;EZUBB*DISCON(TRUE);// ReMureRATE直到安装接收中断;
如果这不起作用,还有一种方法。你可以在FX2LP硬件上发布一个0xA0的供应商命令,在0x600寄存器中写0x01,它将重置该设备。当你在0x600寄存器中再次写入0x00时,设备将退出复位。发布0xA0供应商命令的方法是:1。Req代码=& gt;0xa0 2。值字段(高和低)=0x600 600 3。长度=1;4。数据=& gt;01用于复位,00用于数据相位有效载荷的复位释放。

以上来自于百度翻译


     以下为原文
  Hi Malik,

I think there is an alternate way.Here what you can do is to implement a vendor command which will re-enumerate your device. You can use the following code to do that :
" case VR_RENUM:
*EP0BUF = 7;
EP0BCH = 0;
EP0BCL = 1; // Arm endpoint with # bytes to transfer
EP0CS |= bmHSNAK; // Acknowledge handshake phase of device request
EZUSB_Delay(1000);
EZUSB_Discon(TRUE); // renumerate until setup received
break;
"
    If that does not work, there is one more way.You can issue an 0xa0 vendor command which is implemented in FX2LP hardware to write 0x01 at 0xE600 register which will reset the device.And when again you will write 0x00 at 0xE600 register the device will come out of reset.
The way to issue 0xa0 vendor command is:
1. Req code => 0xa0
2. value field(high and low) => 0xE600
3. Length => 1
4. data => 01 for reset and 00 for reset release in the payload of data phase.
举报

陈敏杰

2019-3-20 10:27:04
嗨,Shub,
在CysB.SIS的新CyAPI.NET中,有一个Cyfx2Dea:文件说:
公空重置(int hold)描述:Cyfx2设备的复位方法停止或启动FX2芯片。保持参数决定复位命令的效果。HOLD==0使FX2恢复执行。保持==1停止芯片。
我的问题是:复位函数的内部操作是什么?与您所描述的0xA0供应商命令相同吗?
此外,还有另一个函数叫做RESET,它定义在CysBoStor类中。公共BOOL RESET()描述重置导致USB设备重置为其初始电源配置。那么这两个复位函数有什么区别呢?
谢谢。

以上来自于百度翻译


     以下为原文
  Hi Shub,
    In the new CyAPI.net for CyUSB.sys, there is a function CyFX2Device::Reset. The documentation said :
    public void Reset(int hold)
Description
The Reset method of CyFX2Device halts or starts the FX2 chip.
The hold parameter determines the effect of the Reset command.
hold == 0 causes the FX2 to resume execution.
hold == 1 halts the chip.
    My question is : what's the internal operation of the Reset function. Is it same with the 0xa0 vendor command as you described?
    In addition, there is another function called Reset which is defined in  CyUSBDevice class.
public bool Reset ( )
Description
Reset causes the USB device to be reset to its initial power-on configuration.
 
So what's the difference between these two Reset functions?
    Thanks. 
   
 
举报

何柳青

2019-3-20 10:43:36
你好,
第一次重置通过0xA0卖方命令写入FX2LP的CPUCS寄存器(0xE600),以重置或运行8051。
后者发送USB总线重置,然后重新枚举该设备。
当做,
阿南德

以上来自于百度翻译


     以下为原文
  Hi,
    The first reset writes to CPUCS register (0xE600) of FX2LP through 0xA0 vendor command to reset or run the 8051.
    The latter sends a USB bus reset and then re-enumerates the device.
    Regards,
    Anand
举报

陈敏杰

2019-3-20 10:51:25
嗨,阿南德,
谢谢你的快速回复。
对于第一种情况,我们需要在固件中处理0xA0供应商命令吗?或者这个命令将由硬件自动完成?
目前,我们正在开发一种实时成像设备。实时图像通过68013A传输到PC.,在每个帧的开头,我们放一些同步报头。有时我们发现一些帧会有一些随机偏移。我们认为,这些偏移可能是由68013A FIFO缓冲器上的一些错误引起的。当我们检测到帧同步报头不正确时,我们想要重置69013A。
所以我的问题是:对于我们的情况,哪种复位方法更好?
谢谢,
麦兆照

以上来自于百度翻译


     以下为原文
  Hi Anand,
    Thanks for your quick reply.
    For the first case, do we need to process the 0xa0 vendor command in the firmware? or this command will be done by hardware automatically?
    Currently we are developing a real-time imaging device. The real-time images are transfered through 68013A to PC. At the beginning of each frame we put some sync header. Occasionally we found that some frames will have some random offset. We think that these offsets may be caused by some error on 68013A FIFO buffer. When we detect that the frame sync header is not correct, we want to reset the 69013A. 
    So my question is : for our case, which Reset method is better?
    Thanks,
    Mczhao
举报

更多回帖

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