Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > shut down safe handle

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



shut down safe handle
Moderator:
RSKV

Post Reply
Follow this topic



shut down safe handle

gjhave posted on 08 Nov 2012 4:59 PM PST
Senior Member
15 Forum Posts

Hi:

     please help!  I wrote a USBLIB.dll file useing CYUSB.dll with C#. there is a trouble in running XferData method of CyUSBEndPoint. The erro information is "shut down safe handle"(i translated it from chinese, i don't know if it's correct). Please see my code below:

       public CUSB()         //class consductor function work normally
        {
            usbDeviceList = new USBDeviceList(CyConst.DEVICES_CYUSB);
            iDeviceCount = usbDeviceList.Count;
            if (iDeviceCount != 0)
            {
                for (int i = 0; i < iDeviceCount; i++)
                {
                    myDevice[i] = usbDeviceList[i] as CyFX2Device;
                }
            }
        }

       public ErrFlag InitialDevice(int devcie, string fwFile)   //this function work normally
        {
            if(!myDevice[devcie].LoadRAM(fwFile))
            {
                return ErrFlag.ErrInit;
            }
            return ErrFlag.NoErr;
        }

       public ErrFlag GPIOCTRL(int device,byte PortSel, byte PinSel, bool HighLow)
        {
            byte[] DataBuf = new byte[4];
            int Len = 4;
            DataBuf[0] = 0x00;                                        //command code
            DataBuf[1] = PortSel;                                    
            DataBuf[2] = PinSel;
            if (HighLow)
                DataBuf[3] = 0x01;
            else
                DataBuf[3] = 0x00;
            
            if (!myDevice[device].InterruptOutEndPt.XferData(ref DataBuf, ref Len))                    //erro in here
                return ErrFlag.ErrIntOut;
            if (Len < 4)
                return ErrFlag.ErrIntOut;          

            return ErrFlag.NoErr;
        }

       can you give me some advise?




Re: shut down safe handle

gjhave posted on 08 Nov 2012 09:42 PM PST
Senior Member
15 Forum Posts

additional, i found some times, in my CyUSBDevice instance, except control endpoint, all the others are null. please see my screenshort i attachment jpg file.

My instantiation is:

usbDeviceList = new USBDeviceList(CyConst.DEVICES_CYUSB);
            iDeviceCount = usbDeviceList.Count;
            if (iDeviceCount != 0)
            {
                for (int i = 0; i < iDeviceCount; i++)
                {
                    myDevice[i] = usbDeviceList[i] as CyUSBDevice;
                }
            } 



Re: shut down safe handle

Gayathri posted on 09 Nov 2012 05:31 AM PST
Cypress Employee
428 Forum Posts

 Hi,

 

From the screenshot, I could see that the device handle being shown is for the default FX2LP device (i.e. VID/PID = 0X04B4/ 0x8613). Please download the appropriate application firmware, if not downlaoded and test. Or if the screenshot is taken at the wrong the, please upload the right one. Also check if  handle to Interrupt OUT EP is null just before calling "InterruptOutEndPt.XferData". If so you would be getting NULL reference found exception.

 

Regards,

Gayathri



Re: shut down safe handle

gjhave posted on 11 Nov 2012 05:14 PM PST
Senior Member
15 Forum Posts

Hi Gayathri:

      Thanks for your reply,  i'm using a cy68013a chip, so the FX2LP device and screenshot is ok. My application firmware what i download to cy68013a's RAM is working well in my VC++6.0 application. So my problem is why it doesn't work with my C# application? And also i don't know why the all the EP are null but control endpoint?






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20