13 Replies Latest reply on Oct 3, 2017 5:43 PM by NoriakiT_91

    USB  as multiple COM ports?

      Hi there, I checked the USBUART component.


      According to what I have understood, it lets the USB act as a COM port (which I can access via hyperterminal/putty,etc..)


      Suppose my application requires me to have 2 [or multiple] COM ports.


      Is it possible to have the USB act as multiple COM ports?



        • 1. Re: USB  as multiple COM ports?
                  Hello Goose. I hope you are better. please read at: http://www.cypress.com/?app=forum&rID=66583 best regards, jesus. pd, it if you are using psoc 3,4,5 platform.   
          • 2. Re: USB  as multiple COM ports?

            The question was abourt USB-UARTs (CDC ports), not about physical UARTS.


            I would guess that USB would support having multiple virtual COM ports over a single USB connection. For example the FT2232 supports this IIRC. But I would also guess that the default windows driver cannot handle this...


            Also, the USBUART component cannot handle this AFAIK, you would need to roll your own USB device driver on the PSoC side...


            What is your use case here? Is there a reason not to handle multiple transfers of a single COM port? (I think the useable bandwidth would also be reduced in this scenario).

            • 3. Re: USB  as multiple COM ports?
                      Hi Hli. thanks for your reply and corrections. regards, jesus   
              • 4. Re: USB  as multiple COM ports?

                Hello hli, thanks for you reply......there is no particular reason for me not to use a single port for multiple transfers..


                Its just that, I somehow got to know that using USB as multiple COM ports is infact possible in PSoC. So I just wanted to try it out.


                However, I dont think it can be done by mere use of the APIs.


                So I was just looking for a clue as to how to go through with it? [just to increase my PSoC knowledge]





                • 5. Re: USB  as multiple COM ports?
                          Any update on this ......anyone? Regards.   
                  • 6. Re: USB  as multiple COM ports?

                    Hi there, I got to know that to actually achieve this [just incase anyone needs to...], one would require some changes to be made in the attached file........some application-level changes.

                    • 7. Re: USB  as multiple COM ports?

                      Hi Goose,


                      I am attempting to do the same. Could you advise me on how I can do this?




                      Many thanks,



                      • 8. Re: USB  as multiple COM ports?


                        I have created a composite device with two COM ports.

                        One COM port is operating correctly but the other COM port is not working properly...

                        Where should I fix it?


                        • 9. Re: USB  as multiple COM ports?

                          It seems that there is an API function USBUART_GetComPort(void) to select one of two COM ports.  Following snapshot comes from the USBUART component datasheet.


                          Actually, I didn't use this API function.  Can you try this API function?




                          • 10. Re: USB  as multiple COM ports?

                            thank you for your reply.

                            I described SetComPort for each EP interrupt in USBUART_1_episr.c

                            For the time being, the program is working as intended.

                            Is this the correct way?

                            • 11. Re: USB  as multiple COM ports?

                              You don't need to modify the episr file.  Just call USBUART_SetComPort() before calling port associated APIs.  I have modified the project attached to this discussion as follows.


                                      // the number of bytes        
                                      Count = USBUART_GetCount();
                                      if(Count != 0){
                                          //Get data
                                          if(Buffer[0] == '?'){
                                              // Send data
                                              USBUART_PutData(Hello, Count2);
                                              //wait tx
                                              // Echo data
                                              USBUART_PutData(Buffer, Count);
                                              //wait tx


                              And the execution result as follows.


                              At the end of for-loop you called USBUART_DataIsReady() API function to wait for TX completed.  But the API is incorrect.  USBUART_CDCIsReady is used to wait for the TX completion.


                              Attached project is modified for the CY8CKIT-059 without using the external crystal oscillator.




                              • 12. Re: USB  as multiple COM ports?

                                Thank you for your kindness.

                                We will provide a project for SetComPort in USBUART_1_episr.c for reference only.


                                And the execution result as follows.


                                The attached project file was created with CY8C5868AXI-LP035.

                                • 13. Re: USB  as multiple COM ports?

                                  Please let me add a comment.


                                  It is recommended to use a MACRO CALLBACK feature to add your own code to the ISR procedure.  You can declare a CALLBACK in the "cyapicallbacks.h" header file like as follows to be invoked from the ISR .


                                  #ifndef CYAPICALLBACKS_H
                                  #define CYAPICALLBACKS_H
                                      /*Define your macro callbacks here */
                                      /*For more information, refer to the Writing Code topic in the PSoC Creator Help.*/
                                      #define USBUART_1_EP_1_ISR_ENTRY_CALLBACK
                                      extern void USBUART_1_EP_1_ISR_EntryCallback(void);
                                      #define USBUART_1_EP_2_ISR_ENTRY_CALLBACK
                                      extern void USBUART_1_EP_2_ISR_EntryCallback(void);
                                  #endif /* CYAPICALLBACKS_H */   


                                  The callback function can be described in any C files like main.c


                                  void USBUART_1_EP_1_ISR_EntryCallback(void) {
                                  void USBUART_1_EP_2_ISR_EntryCallback(void) {


                                  This feature was implemented in PSoC Creator 3.3  You don't need to modify the "Generated_Source" files anymore when using the CALLBACK feature.