- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Goose,
I am attempting to do the same. Could you advise me on how I can do this?
Many thanks,
G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Regards,
Noriaki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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