jmg 发表于 2023-5-8 16:24:10

DebugLab 发表于 2023-5-8 15:19
If you use official routines, you can use the XDATA version of the USB-CDC library.

Is there a link for the XDATA HEX file for the latest official version ?

kksk 发表于 2023-5-8 16:45:28

Can you post a picture of your device? So that the staffs can determine what device are you using (seems that they are not sure about this).


========
FYI. I tested this (text "STC-USB-TO-2 UART-TINY, 2022-10-27" on its back), and found that text can be missing while sending long documents (40 kiB plain txt file) on baud 115200.





乘风飞扬 发表于 2023-5-8 16:58:15

本帖最后由 乘风飞扬 于 2023-5-8 17:18 编辑

assistant /USB-CDC is a serial port, it will add 10M/6M/5M/4M/3M/2.5M/2M/1.5M/1M bps serial port communication speed for everyone to choose
We can add new items to the program, like this:
switch (baud)
    {
      case 14400:
      case 19200:
      case 28800:
      case 38400:
      case 57600:
      case 115200:
      case 230400:
      case 460800:
      case 921600:    //divisible by 22.1184M
            SetMCLK(0); //clock 22.1184MHz
            break;
      case 1500000:
      case 3000000:
      case 6000000:   //divisible by 30M
            SetMCLK(2); //clock 30MHz
            break;
      default:
            if(baud < 1000000)
                SetMCLK(1); //clock 24MHz
            else
                SetMCLK(3); //clock 40MHz
            break;
    }The video demonstrates the process of sending and receiving 1024 bytes of data
attach://9671.mp4
The device connection is shown in the figure




jmg 发表于 2023-5-8 17:23:52

kksk 发表于 2023-5-8 16:45
Can you post a picture of your device? So that the staffs can determine what device are you using (s ...

Yes, I test with exact same PCB labeled text "STC-USB-TO-2 UART-TINY, 2022-10-27" on its back

I send files of various sizes, and confirm the bytes sent on other hardware. Only small files have zero loss.

jmg 发表于 2023-5-8 17:35:32

本帖最后由 jmg 于 2023-5-8 17:45 编辑

乘风飞扬 发表于 2023-5-8 16:58
assistant /USB-CDC is a serial port, it will add 10M/6M/5M/4M/3M/2.5M/2M/1.5M/1M bps serial port com ...
Yes, I tested the code as-shipped in the device.

Notice the BAUD is set by MAIN_Fosc / 4, so 6M from 30M is not possible, in your comments.
6M and 3M are possible from 24M MAIN_Fosc

Notice I do not test using STC UART helper, I use a proper Terminal program, that is proven to work on FT232H at 12MBd on large files continually. (1 stop bit)
On USB-UARTS like CP2102N, FT231X, PL2303GC, CH9102there are no problems with no dropped characters and sustained speeds to ~ 3MBd have 1 STOP bit as expected.
Those parts can send continually streamed bytes, with no pauses.

At 2MBd with only 1 channel TX only, on the STC8H8K64U Board, I measure byte times of 14 or 15 bit times, ie an extra 4 or 5 stop bits.

jmg 发表于 2023-5-8 17:58:08

本帖最后由 jmg 于 2023-5-9 07:16 编辑

Published at 2023-5-8 16:58 by Chengfengfeiyang
assistant /USB-CDC is a serial port, it will add 10M/6M/5M/4M/3M/2.5M/2M/1.5M/1M bps serial port com . . .
If I test using the CDC helper, I see it is very slow, with long pauses between packets. Below is 2MBd with 100,000 file
That slow send masks the transmit loss effect.

Addit: When I zoom into those 2MBd bursts, it shows as 4 bytes then a 72.4us pause, then the other 252 bytes, and all bytes look to be sent with 14 bits total framing (ie 5 stop bits)
The 252 bytes times as 252*14/2M= 1764us
The very long pause between 256 byte payloads, looks to be deliberate in CDC helper, likely to avoid showing this bug !Other terminal pgms without this patched delay expose the TX character drop bug.

To be used as a useful USB-UART, it really needs to   
a) not drop characters in continual TX (serious bug)
b) have no gaps
c) send 1 stop bit, when asked, at least at modest BAUD rates like 2MBd
\temp\STC8H8K64U_CDC_UartHelper_SlowAverageSpeed.png

乘风飞扬 发表于 2023-5-8 19:17:35

jmg 发表于 2023-5-8 17:35
Yes, I tested the code as-shipped in the device.

Notice the BAUD is set by MAIN_Fosc / 4, so 6M fr ...

You are right, 6M and 3M are possible from 24M MAIN_Fosc.
Have you tried using "STC-USB-TO-2 UART-TINY" CDC1 to communicate with CDC2?

jmg 发表于 2023-5-9 07:18:05

Have you tried using "STC-USB-TO-2 UART-TINY" CDC1 to communicate with CDC2?

I usually test TX first as failures in TX mean RX is not much use. Loopback does 'work', with the caveats mentioned.

jmg 发表于 2023-5-9 08:24:15

As a comparison, here is a newish USB-UART, CH9102 sending at 6M 8N1 with average sustained speed of 5.562Mbd
Comments
a) There is exactly 1 stop bit when asked
b) smallest packet grouping is 64 bytes, with occasional gaps for groupings
c) No bytes are lost and at this high baud rate, it sustains an average of 5.562Mbd

This CH9102 is appx state of art at FS-USB, based on their 8051 MCUs, whilst HS-USB parts like FT2232H can sustain 12Mbd averages.

乘风飞扬 发表于 2023-5-9 10:05:57

jmg 发表于 2023-5-9 08:24
As a comparison, here is a newish USB-UART, CH9102 sending at 6M 8N1 with average sustained speed of ...

What's the name of this software? I want to test it with this software.

https://www.stcaimcu.com/data/attachment/forum/202305/09/082302fh3z9zxh8u4t3fp4.png


页: 1 [2] 3
查看完整版本: USB to 2 serial ports-STC8H tests, and bugs