cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

New Contributor II

Hi all,

I am using CY8CKIT-059 with usbuart (USBFS) module. I am sending a .txt file (2MBytes) from PC to Cypress using teraterm. I am woking with the example code USBFS_UART and this is working fine but that is slow process. can anyone please help how I can change (increase) the Baud rate for USBUART(USBFS) module ?

and one more thing is "count = USBUART_GetAll(buffer)" this function will return number of bytes received and the maximum amount of the received at a time data is 64 bytes but When I am printing the count value eachtime it is 64,36,64,36,64,36...........like that. So why it is 36 bytes and not 64 bytes in each even iteration?

0 Likes
Reply
1 Solution
Moderator
Moderator

Hello AbPa_4654881

The USBUART user module uses the USB Interface to emulate a COM port . The PC application is using USB connection as an RS-232 COM connection . The settings in a terminal application (baud rate, data bits, parity, stop bits and flow control) do not affect the performance of data transmissions because it is a USB device and the USB protocol is used to control data flow.

The data transfer will be happening at the rate of Full Speed USB device which is 12Mbps. The USB data rate of full speed is as per USB 2.0 specification.

As mentioned by you "count = USBUART_GetAll(buffer)" this function will return number of bytes received by the device (transferred by the host). Can you please attach the project you are using for this application? Also can you please let us know how are you transferring the.txt file from tera term?

This will help us to determine the why is this behavior of a 64 byte transfer followed 36 byte transfer is observed.

Can you please confirm if in the end are you able to receive the complete data?

Best Regards

Ekta

View solution in original post

6 Replies
Moderator
Moderator

Hello AbPa_4654881

The USBUART user module uses the USB Interface to emulate a COM port . The PC application is using USB connection as an RS-232 COM connection . The settings in a terminal application (baud rate, data bits, parity, stop bits and flow control) do not affect the performance of data transmissions because it is a USB device and the USB protocol is used to control data flow.

The data transfer will be happening at the rate of Full Speed USB device which is 12Mbps. The USB data rate of full speed is as per USB 2.0 specification.

As mentioned by you "count = USBUART_GetAll(buffer)" this function will return number of bytes received by the device (transferred by the host). Can you please attach the project you are using for this application? Also can you please let us know how are you transferring the.txt file from tera term?

This will help us to determine the why is this behavior of a 64 byte transfer followed 36 byte transfer is observed.

Can you please confirm if in the end are you able to receive the complete data?

Best Regards

Ekta

View solution in original post

New Contributor II

Hi Ekta,

Thanks, I am using teraterm to send .txt file. there is an option inside teraterm under File -> send file after selecting the com port my .txt file is around 1Mbytes.and I am receiving complete data at the other side without any loss.

Attached the example project here.

0 Likes
Reply
Employee

Each packet sent by PC and received by PSoC is sent as a BULK transfer packet.  The BULK transfer packet is created by PC and sent in multiple packets which maximum size is 64 Bytes.  So, I assume that you are sending 100Byte strings from your PC application and the PC divided the string into two packets 64+36 Bytes.

So, if you send 64 Bytes packets or multiples of 64 Bytes like 128 Bytes packets in your application, PC will send 64 Bytes packets and PSoC receives 64 Bytes packet only..

There is another solution.  For example, if you send ten 100Bytes string at once in a 1000Bytes string, the string will be divided into 15 64Bytes packets and one 40Bytes packet.  Total number packets is 16 comparing to 20 packets in your application.  This will increase the through put too.

Regrads,

Noriaki

Honored Contributor

AbPa,

As Ekta indicated the maximum USB data rate is about 12 Mbps.  This means you can transfer data between the PC and PSoC at about 12Mbps/(8bits/byte) = 1.5MBps.   There is some USB header and protocol negotiation that needs to occur therefore I have measured my uses on the USBFS_UART component at 1.3MBps.

When you configure the USBFS_UART component on the PSoC there is no place for a baudrate.

Therefore, the main limitation for the data transfer rate is the PC term program.   With your teraterm program set it to the maximum UART baudrate allowed WITHOUT changing anything on the PSoC SW.

You will notice that the serial transfer rate is automatically working and faster.

Len

Len
"Engineering is an Art. The Art of Compromise."
New Contributor II

Hi Len

Thanks, As the USB data rate is about about 12 Mbps(1.5MBps) but I am seeing very less speed(<50kBps) compare to 1.5MBps while sending .txt file using teraterm and as you mentioned that you are able to measure the USBFS_UART component at 1.3MBps. Can you please tell How you are able to measure That speed and How I can Increase speed in my case.

0 Likes
Reply
Honored Contributor

AbPa,

1.5Mbps is the maximum rate available to the USB 3.0 supported by the PC and the PSoC5.

Maximum is the keyword.   The bottlenecks in the data can be due to other factors on either end of the comm chain.

... while sending .txt file using teraterm ...

One of the limiting factors could be due to teraterm.   What is the baudrate setting in your teraterm session?

If you're using 115.2Kbps with 8N1 as the comm spec in teraterm, then the fastest you can transfer data is 115.2Kbps/10bits = 11.5KBps.  As you can see this part of the formula is simple.  Baudrate/10.

Since you indicated you were dumping a .txt file from teraterm, there may be some limits as to how fast the data can be read from the PC and then dumped through teraterm.

The next bottleneck may be at the PSoC5.   The USBFS_UART can read data at maximum speed (1.5Mbps) for 64 bytes.  Once the 64 bytes are received, the data needs to be moved out of the buffer and be used.   Common strategies are to use a dual-buffering scheme with DMA assist.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Reply