You are here

shut down Safe handle | Cypress Semiconductor

shut down Safe handle

Summary: 1 Reply, Latest post by Gayathri on 09 Nov 2012 07:32 AM PST
Verified Answers: 0
Last post
Log in to post new comments.
gjhave's picture
17 posts


      Help! i wrote a new USBLIB.dll using CyUSB.dll by C#,  there's an erro during my program perform InterruptOutEndPt.XferData(ref DataBuf, ref Len) method, it's show "shut down safe handle"

below is my code:

        public int iDeviceCount;

        USBDeviceList usbDeviceList;

        CyFX2Device[] myDevice = new CyFX2Device[4];


        public CUSB()


            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 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;


                DataBuf[3] = 0x00;


            if (!myDevice[device].InterruptOutEndPt.XferData(ref DataBuf, ref Len))

                return ErrFlag.ErrIntOut;

            if (Len < 4)

                return ErrFlag.ErrIntOut;



            return ErrFlag.NoErr;





gaya's picture
Cypress Employee
578 posts
Log in to post new comments.