请教EZUSB_68013_上位机问题

[复制链接]
4156|8
 楼主| xidian123 发表于 2009-2-26 10:39 | 显示全部楼层 |阅读模式
大家好,我在使用cypress的68013的开发板。上位机使用官网提供的基于C#的类库,正在学习相关的例子程序。可是一开始就碰到了棘手的问题,请看下面的代码 

    public partial class Form1 : Form 
    { 
        App_PnP_Callback    evHandler; 
        CyUSBDevice        loopDevice  = null; 
        USBDeviceList      usbDevices  = null; 
        CyBulkEndPoint      inEndpoint  = null; 
        CyBulkEndPoint      outEndpoint = null; 

        Thread  tXfers; 
        bool    bRunning = false; 

        int    value; 
        long    outCount, inCount; 

        const int XFERSIZE  = 256; 
        byte[]  outData    = new byte[XFERSIZE]; 
        byte[]  inData      = new byte[XFERSIZE]; 

        // These 2 needed for TransfersThread to update the UI 
        delegate void UpdateUICallback(); 
        UpdateUICallback updateUI; 
    

        public Form1() 
        { 
            InitializeComponent(); 

            // Setup the callback routine for updating the UI 
            updateUI    = new UpdateUICallback(StatusUpdate); 

            // Setup PnP event handling 
            evHandler = new App_PnP_Callback(PnP_Event_Handler); 

            // Create a list of CYUSB devices 
            usbDevices  = new USBDeviceList(CyConst.DEVICES_CYUSB, evHandler); 
            setDevice(); 
        } 

        public void setDevice() 
        { 
            if (usbDevices.Count > 0) 
                loopDevice = usbDevices[0x0547, 0x0080] as CyUSBDevice; 

            StartBtn.Enabled = (loopDevice != null); 

            if (loopDevice != null) 
                Text = loopDevice.FriendlyName; 
            else 
                Text = "Bulkloop - no device"; 

            // Set the in and out endpoints per the selected radio buttons. 
            EptPair1Btn_Click(this, null); 
        } 
………… 

执行 
usbDevices  = new USBDeviceList(CyConst.DEVICES_CYUSB, evHandler); 
始终不成功,无法获得usb设备列表,usbDevices.Count一直为零,不知是什么原因?驱动我也已经换成了他.net包里头的驱动了,系统正常识别开发板,控制面板也正常识别开发板,就是他的例子程序无法正常识别。。但基于c++的例子程序就能够正常识别。。请大家帮忙,谢谢~~~ 
 楼主| xidian123 发表于 2009-2-26 14:30 | 显示全部楼层

大家来帮忙啊

补充:
我换到我的台式机上去,基于.net的c#例子程序就能够认到开发板了。。我的笔记本和台式机都装的一样的framework2.0~~太奇怪了
 楼主| xidian123 发表于 2009-2-26 14:57 | 显示全部楼层

补充2

还有,就是在笔记本上,基于.net的c#例子程序是可以认出我使用的usb鼠标的。。
jxin 发表于 2009-2-26 15:43 | 显示全部楼层

请发一下你的注册表信息 如附件

 楼主| xidian123 发表于 2009-2-26 16:18 | 显示全部楼层

附件1

请看~~楼上的同学好,是你在cypress的case里回答我吗?
 楼主| xidian123 发表于 2009-2-26 16:19 | 显示全部楼层

附件2

附件2
 楼主| xidian123 发表于 2009-2-26 16:22 | 显示全部楼层

继续

注册表里头,..Enumusb 键下一大堆东西,删也删不掉。。
 楼主| xidian123 发表于 2009-2-26 16:39 | 显示全部楼层

解决了

哈哈,解决了~~~受到楼上启发,我用工具把这些04b4的键值全删掉,然后再重新插上板子,c#程序就认了。。。谢谢~~~~太感谢了。。。。
 楼主| xidian123 发表于 2009-2-27 10:12 | 显示全部楼层

继续问

虽然问题解决了,但是还是没想明白,cyusb.dll是通过什么去识别和区别插入的EZUSB设备的??
上位机程序识别到2个USB设备,鼠标和cypress的开发板,但是usbDevices.Count=1,他并没有把鼠标当作cypress的usbDevices~~~

请指教~~~~谢谢~~
您需要登录后才可以回帖 登录 | 注册

本版积分规则

16

主题

54

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部