11 Replies Latest reply on Mar 27, 2020 10:57 AM by StGr_4575901

    PSoC5LP - Multiple USB devices on single USBFS component?


      Hi all,


      I have some questions about USB functionality on a PSoC5LP.  The project I'm working on requires multiple USB devices on a single USB connection.  Namely, both a USB HID (keypad) and a USB UART.  I have gotten both of these components working separately (I.E. in different projects) but I can't seem to figure out how to run both these devices at the same time on the same USBFS component.  For the USB UART, I used the descriptor template USBUART_TwoComPorts.root.xml (came with PSoC Creator) and deleted the second COM port from the descriptor (CDC Interface 3 and 4), as I only need one of the COM ports.  This works on its own, and I can take data in and echo it back to the virtual COM port as seen from my PC.  However I can't seem to get it working in conjunction with a USB HID in the same component.


      I imagine there are rules to running multiple devices on this single USBFS component, I'm just not aware of them.
      I'm currently starting USB up as follows:


      uint8 Keyboard_Data[8] = {0,0,0,0,0,0,0,0};
      USBFS_1_Start(0,USBFS_1_DWR_VDDD_OPERATION);  //Start up the USB HID Keypad    
      USBFS_1_Start(1,USBFS_1_DWR_VDDD_OPERATION);  //Start up the USB UART
      USBFS_1_LoadInEP(1, Keyboard_Data, 8);


      I then call the following periodically to send keyboard data:


      if(USBFS_1_bGetEPAckState(1)) {
          USBFS_1_LoadInEP(1, Keyboard_Data, 8);


      I also call a periodic function to take in CDC data and echo it back:


          if (USBFS_1_DataIsReady()){
              count = USBFS_1_GetAll(USB_Buffer);     /*MAX 64 BYTES PER SPEC*/
              if (count != 0){
                  /*We have data*/   
                  /*Wait until ready to send data*/
                  while (!USBFS_1_CDCIsReady());
                  /*Echo it back*/
                  /*If we are at max buffer size, append a NULL to assure PC identifies end of data*/
                  if (count == MAX_USBUART_BUFFSIZE){
                      while (!USBFS_1_CDCIsReady());


      Where I run into problems is when I attempt to add a USB UART.


      My question is, in what way should I be configuring/starting the devices up as to have the USB UART function at the same time as the HID Keypad?  What considerations do I need to have in mind so that the devices play nice with each other?  I'm very new to using PSoC and USB so it's possible it's something very obvious that I'm just not familiar with.


      Any advice would be greatly appreciated.