1 Reply Latest reply on Feb 27, 2019 9:00 AM by KyTr_1955226

    PSoC5 USB HID Mouse not recognized at power on

    user_3538936

      Dear Sirs,

      I'm facing some problems with a device I've designed based on PSoC5 implementing a USB HID mouse in particular:

      initial condition is with the host PC off and with the mouse already connected into an USB port, then when the PC is powered on at the startup of the Operating System (Red Hat 7 Update 1) the mouse doesn't work, the pointer isn't moving on the screen when the user try to.

      The device is present in the connected peripherals, but doesn't not send "events".

      If the device is disconnected and reconnected to a USB port with the PC switched on then it is operative and it works. This same behavior has also been verified with the Windows operating system.

      Moreover although it is recognized at runtime (thus connecting it to the PC already on), under the graphics interface (X) of Red Hat 7 Update 1 there is no movement but only the left button seems to work. Instead, under Windows, the device is seen as a mouse and it works ok.

      The device descriptor is based on CE195394 - USB HID Mouse with PSoC 3/ PSoC 5LP with the remote wakeup enabled.

      Can you please provide me some information to solve this issue?

      Best Regards

       

       

        • 1. Re: PSoC5 USB HID Mouse not recognized at power on
          KyTr_1955226

          Possibly something to do with the detection of VUSB and enumerating the device?  I had what sounds like a similar issue on a HID Keyboard device where I would power cycle the host PC and the device would stop working until unplugged and plugged back in.

           

          Turns out VUSB remains high when the PC was off (Most PCs keep their USB ports powered when shut down, can usually change this setting in the BIOS), and since VUSB detection was the only factor in controlling my code to connect/disconnect cleanly, the PSoC still thought it was connected and was getting hung up looking for responses from the host that would never come in.

           

          Compound this on my checking for Endpoint ACK being while() loops instead of if() statements.  It would hang on bGetEPAckState(1) infinitely and never re-enumerate with the host:

           

          if (USB_IsConnected){
                  memcpy(&USB_Data_Out[USB_KEY_INDEX],USB_Keys,MAX_USB_KEYS);  
                  while (!USBFS_bGetEPAckState(1));
                  USBFS_LoadInEP(1,USB_Data_Out,8);
          }
          

           

          USB_IsConnected would be true when VUSB was high and I'd get stuck in there.

           

          I changed it over to this, using USBFS_CheckActivity() to determine my connection state, and removing the while loops:

          if (USB_IsConnected){
              if (USBFS_bGetEPAckState(1)){
                      USBFS_LoadInEP(1,USB_Data_Out,8);
              }
          
              /*No activity on bus, but no falling edge detected on VBUS, stop USB operation*/
              if (!USBFS_CheckActivity()){
                      USB_IsConnected = false;   
                      host_reset = true;
              }
          }
          
          if (host_reset){
                  /*Check for reconnect*/
                  if (USBFS_bGetConfiguration()){
                          USBFS_EnableOutEP(2);
                          USBFS_LoadInEP(1,USB_Data_Out,8);
                          USB_IsConnected = true;
                          host_reset = false;
                  }
          }
          

           

          This let me detect when the device is powered, but the host is not responding.  I then set a flag to start calling USBFS_bGetConfiguration() to determine when the host comes back and re-enumerate.

           

          Hope this helps.  Hard to tell what your issue is when you don't post any of your project.