找回密码
 立即注册
楼主: j***

USB to 2 serial ports-STC8H tests, and bugs

[复制链接]

该用户从未签到

4

主题

89

回帖

708

积分

高级会员

积分
708
 楼主| 发表于 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 ?
回复 支持 1 反对 0 送花

使用道具 举报

  • TA的每日心情
    开心
    7 天前
  • 签到天数: 181 天

    [LV.7]常住居民III

    9

    主题

    310

    回帖

    3859

    积分

    荣誉版主

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


    回复 支持 反对 送花

    使用道具 举报

  • TA的每日心情
    奋斗
    12 小时前
  • 签到天数: 165 天

    [LV.7]常住居民III

    27

    主题

    1457

    回帖

    4536

    积分

    论坛元老

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

    主题

    89

    回帖

    708

    积分

    高级会员

    积分
    708
     楼主| 发表于 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.
    回复 支持 反对 送花

    使用道具 举报

    该用户从未签到

    4

    主题

    89

    回帖

    708

    积分

    高级会员

    积分
    708
     楼主| 发表于 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

    主题

    89

    回帖

    708

    积分

    高级会员

    积分
    708
     楼主| 发表于 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
    回复 支持 反对 送花

    使用道具 举报

  • TA的每日心情
    奋斗
    12 小时前
  • 签到天数: 165 天

    [LV.7]常住居民III

    27

    主题

    1457

    回帖

    4536

    积分

    论坛元老

    积分
    4536
    发表于 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?
    回复 支持 反对 送花

    使用道具 举报

    该用户从未签到

    4

    主题

    89

    回帖

    708

    积分

    高级会员

    积分
    708
     楼主| 发表于 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

    主题

    89

    回帖

    708

    积分

    高级会员

    积分
    708
     楼主| 发表于 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
    回复 支持 反对 送花

    使用道具 举报

  • TA的每日心情
    奋斗
    12 小时前
  • 签到天数: 165 天

    [LV.7]常住居民III

    27

    主题

    1457

    回帖

    4536

    积分

    论坛元老

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




    回复 支持 反对 送花

    使用道具 举报

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

    本版积分规则

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

    GMT+8, 2024-6-17 21:42 , Processed in 0.089152 second(s), 68 queries .

    Powered by Discuz! X3.5

    © 2001-2024 Discuz! Team.

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