找回密码
 立即注册
楼主: jmg

USB to 2 serial ports-STC8H tests, and bugs

[复制链接]
  • 打卡等级:初来乍到
  • 打卡总天数:4
  • 最近打卡:2025-05-01 06:58:22

5

主题

184

回帖

1333

积分

金牌会员

积分
1333
发表于 2023-5-8 16:24:10 | 显示全部楼层
Debu*** 发表于 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 ?
回复 支持 1 反对 0

使用道具 举报 送花

  • 打卡等级:以坛为家I
  • 打卡总天数:328
  • 最近打卡:2025-03-09 19:40:01

9

主题

328

回帖

4501

积分

荣誉版主

积分
4501
发表于 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.


IMG_20230508_163339.jpg Screenshot 2023-05-08 164224.png


回复 支持 反对

使用道具 举报 送花

  • 打卡等级:以坛为家II
  • 打卡总天数:415
  • 最近打卡:2025-04-30 09:58:34
已绑定手机

39

主题

2006

回帖

6843

积分

论坛元老

积分
6843
发表于 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:
  1. switch (baud)
  2.     {
  3.         case 14400:
  4.         case 19200:
  5.         case 28800:
  6.         case 38400:
  7.         case 57600:
  8.         case 115200:
  9.         case 230400:
  10.         case 460800:
  11.         case 921600:    //divisible by 22.1184M
  12.             SetMCLK(0); //clock 22.1184MHz
  13.             break;
  14.         case 1500000:
  15.         case 3000000:
  16.         case 6000000:   //divisible by 30M
  17.             SetMCLK(2); //clock 30MHz
  18.             break;
  19.         default:
  20.             if(baud < 1000000)
  21.                 SetMCLK(1); //clock 24MHz
  22.             else
  23.                 SetMCLK(3); //clock 40MHz
  24.             break;
  25.     }
复制代码
The video demonstrates the process of sending and receiving 1024 bytes of data

The device connection is shown in the figure

1.png


回复 支持 反对

使用道具 举报 送花

  • 打卡等级:初来乍到
  • 打卡总天数:4
  • 最近打卡:2025-05-01 06:58:22

5

主题

184

回帖

1333

积分

金牌会员

积分
1333
发表于 2023-5-8 17:23:52 | 显示全部楼层
kk*** 发表于 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.
回复 支持 反对

使用道具 举报 送花

  • 打卡等级:初来乍到
  • 打卡总天数:4
  • 最近打卡:2025-05-01 06:58:22

5

主题

184

回帖

1333

积分

金牌会员

积分
1333
发表于 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, CH9102  there 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.
回复 支持 反对

使用道具 举报 送花

  • 打卡等级:初来乍到
  • 打卡总天数:4
  • 最近打卡:2025-05-01 06:58:22

5

主题

184

回帖

1333

积分

金牌会员

积分
1333
发表于 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  

STC8H8K64U_CDC_UartHelper_SlowAverageSpeed.png
回复 支持 反对

使用道具 举报 送花

  • 打卡等级:以坛为家II
  • 打卡总天数:415
  • 最近打卡:2025-04-30 09:58:34
已绑定手机

39

主题

2006

回帖

6843

积分

论坛元老

积分
6843
发表于 2023-5-8 19:17:35 | 显示全部楼层
jm*** 发表于 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?
回复 支持 反对

使用道具 举报 送花

  • 打卡等级:初来乍到
  • 打卡总天数:4
  • 最近打卡:2025-05-01 06:58:22

5

主题

184

回帖

1333

积分

金牌会员

积分
1333
发表于 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.
回复 支持 反对

使用道具 举报 送花

  • 打卡等级:初来乍到
  • 打卡总天数:4
  • 最近打卡:2025-05-01 06:58:22

5

主题

184

回帖

1333

积分

金牌会员

积分
1333
发表于 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.
CH9012_6MBd_TX_only_1024Bytes.png
回复 支持 反对

使用道具 举报 送花

  • 打卡等级:以坛为家II
  • 打卡总天数:415
  • 最近打卡:2025-04-30 09:58:34
已绑定手机

39

主题

2006

回帖

6843

积分

论坛元老

积分
6843
发表于 2023-5-9 10:05:57 | 显示全部楼层
jm*** 发表于 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.




回复 支持 反对

使用道具 举报 送花

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|深圳国芯人工智能有限公司 ( 粤ICP备2022108929号-2 )

GMT+8, 2025-5-2 17:58 , Processed in 0.125494 second(s), 107 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表