Skip to content

Commit d083a5d

Browse files
tr1p1eaadriweb
authored andcommitted
Updated baud settings table
Updated baud settings table to fix CH340 (clones should now work)
1 parent 69ba5b1 commit d083a5d

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

src/srldrvce/srldrvce.asm

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ get_device_type:
778778
.any:
779779
ld bc,0
780780
ld a,(yinterfaceDescriptor.bInterfaceClass)
781-
cp $a ; CDC data class
781+
cp a,$a ; CDC data class
782782
jq z,.cdc_int_found
783783
cp $FF ; Vendor specific
784784
jq nz,.find_int_loop
@@ -1061,7 +1061,7 @@ set_rate_ch34x:
10611061
ld hl,ch34x_setup
10621062
jq set_rate_ct
10631063

1064-
; Sets the baud rate of a CH34x device
1064+
; Sets the baud rate of a CP210X device
10651065
; Inputs:
10661066
; ix: Serial device struct
10671067
; hl: Baud rate
@@ -1671,17 +1671,18 @@ default_cdc_setup:
16711671

16721672
; CH34X baud settings
16731673
ch34x_setup:
1674-
db 8 ; number of packets to transfer
1675-
setuppkt $61,$A1,$C29C,$B2B9,$0000,null ; serial init
1676-
setuppkt $61,$A4,$00DF,$0000,$0000,null ; modem on
1677-
setuppkt $61,$A4,$009F,$0000,$0000,null ; modem call
1678-
setuppkt $61,$9A,$2727,$0000,$0000,null ; control lines
1674+
db 6 ; number of packets to transfer
1675+
; setuppkt $C0,$5F,$0000,$0000,$0002,.buf ; get vendor version
1676+
setuppkt $40,$A1,$0000,$0000,$0000,null ; serial init
16791677
.baudFactor = $ + 4
1680-
setuppkt $61,$9A,$1312,$B282,$0000,null ; baud factor
1678+
setuppkt $40,$9A,$1312,$B282,$0000,null ; baud factor
16811679
.baudfOffset = $ + 4
1682-
setuppkt $61,$9A,$0f2c,$0008,$0000,null ; baud offset
1683-
setuppkt $61,$9A,$2518,$00c3,$0000,null ; baud low
1684-
setuppkt $61,$9A,$2727,$0000,$0000,null ; control lines
1680+
setuppkt $40,$9A,$0F2C,$0008,$0000,null ; baud offset
1681+
; setuppkt $C0,$95,$2518,$0000,$0000,.buf
1682+
setuppkt $40,$9A,$2518,$00C3,$0000,null ; parity
1683+
setuppkt $40,$9A,$2727,$0000,$0000,null ; control lines
1684+
setuppkt $40,$A4,$009F,$0000,$0000,null ; modem call
1685+
;.buf: dw 0
16851686

16861687
; FT232RL baud settings
16871688
ft232rl_setup:
@@ -1692,11 +1693,11 @@ ft232rl_setup:
16921693
; CP201X baud settings
16931694
cp210x_setup:
16941695
db 4
1695-
setuppkt $41,$00,$0001,$0000,$0000,null ; CP210X_IFC_ENABLE
1696-
setuppkt $41,$07,$0303,$0000,$0000,null ; CP210X_SET_MHS (RTS/DTR)
1696+
setuppkt $40,$00,$0001,$0000,$0000,null ; CP210X_IFC_ENABLE
1697+
setuppkt $40,$07,$0303,$0000,$0000,null ; CP210X_SET_MHS (RTS/DTR)
16971698
.baudRate = $ + 2
1698-
setuppkt $41,$01,$0180,$0000,$0000,null ; 9600 for CP2102 (0x384000 / baudrate)
1699-
setuppkt $41,$03,$0800,$0000,$0000,null ; CP210X_SET_LINE_CTL ((dataBits << 8) | parity | stopBits)
1699+
setuppkt $40,$01,$0180,$0000,$0000,null ; 9600 for CP2102 (0x384000 / baudrate)
1700+
setuppkt $40,$03,$0800,$0000,$0000,null ; CP210X_SET_LINE_CTL ((dataBits << 8) | parity | stopBits)
17001701

17011702
;========================================================================
17021703
; Baud rate data look-up tables

0 commit comments

Comments
 (0)