-
1. Re: USB as multiple COM ports?
JECA_264511 Jun 28, 2013 1:17 PM (in response to userc_41927)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?
helic_263931 Jun 28, 2013 3:25 PM (in response to userc_41927)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?
JECA_264511 Jun 28, 2013 4:16 PM (in response to userc_41927)Hi Hli. thanks for your reply and corrections. regards, jesus -
4. Re: USB as multiple COM ports?
userc_41927 Jul 1, 2013 12:50 AM (in response to userc_41927)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]
Regards.
-
5. Re: USB as multiple COM ports?
userc_41927 Jul 13, 2013 1:45 PM (in response to userc_41927)Any update on this ......anyone? Regards. -
6. Re: USB as multiple COM ports?
userc_41927 Oct 15, 2013 10:57 AM (in response to userc_41927)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?
userc_41752 Dec 1, 2014 6:17 PM (in response to userc_41927)Hi Goose,
I am attempting to do the same. Could you advise me on how I can do this?
Many thanks,
G
-
8. Re: USB as multiple COM ports?
YaIs_283501 Oct 2, 2017 5:05 PM (in response to userc_41927)hello
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?
-
-
10. Re: USB as multiple COM ports?
YaIs_283501 Oct 3, 2017 3:09 AM (in response to NoriakiT_91)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?
NoriakiT_91 Oct 3, 2017 9:57 AM (in response to YaIs_283501)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.
for(;;) { // the number of bytes USBUART_SetComPort(USBUART_COM_PORT1); Count = USBUART_GetCount(); if(Count != 0){ //Get data USBUART_SetComPort(USBUART_COM_PORT1); USBUART_GetAll(Buffer); if(Buffer[0] == '?'){ // Send data USBUART_SetComPort(USBUART_COM_PORT2); USBUART_PutData(Hello, Count2); //wait tx USBUART_SetComPort(USBUART_COM_PORT2); while(!USBUART_CDCIsReady()){} }else{ // Echo data USBUART_SetComPort(USBUART_COM_PORT1); USBUART_PutData(Buffer, Count); //wait tx USBUART_SetComPort(USBUART_COM_PORT1); while(!USBUART_CDCIsReady()){} } } }
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.
Regards,
Noriaki
-
12. Re: USB as multiple COM ports?
YaIs_283501 Oct 3, 2017 5:00 PM (in response to NoriakiT_91)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.
-
Design01.cyprj.Archive01.zip 613.2 K
-
-
13. Re: USB as multiple COM ports?
NoriakiT_91 Oct 3, 2017 5:43 PM (in response to YaIs_283501)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) { USBUART_1_SetComPort(0); } void USBUART_1_EP_2_ISR_EntryCallback(void) { USBUART_1_SetComPort(0); }
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.
Regards,
Noriaki