使用官方例程:tty_test_ch9434.c
1、初始化(./cdn_spi_test -D /dev/ttyWCH2 -S 115200 -v)時(波特率115200),RS485提示失能失敗;
2、寫數(shù)據(jù)時,串口數(shù)據(jù)可以收到數(shù)據(jù);
3、串口發(fā)送數(shù)據(jù)時,使用例程不能獲取數(shù)據(jù),將串口的波特率改的小于115200,驅(qū)動會打印出日志,越接近115200接收的數(shù)據(jù)越準確,但是串口設(shè)置為115200驅(qū)動無反應,沒有數(shù)據(jù)可以接收過來。
4、SPI時鐘設(shè)置的是3000000。
初始化日志:
# ./cdn_spi_test -D /dev/ttyWCH2 -S 115200 -v
[? ?50.582614] ch943x_spi spi2.0: ch943x_pm
[? ?50.582673] ch943x_spi spi2.0: ch943x_startup
[? ?50.582897] ch943x_spi spi2.0: ch943x_port_write - reg:0xa2, val:0x 6
[? ?50.585090] ch943x_spi spi2.0: ch943x_port_write - reg:0xa2, val:0x81
[? ?50.585247] ch943x_spi spi2.0: ch943x_port_write - reg:0xa3, val:0x 3
[? ?50tty device test ok.
libtty_setopt speed = 115200
.585399] ch943x_spi spi2.0: ch943x_port_write - reg:0xa1, val:0x d
[? ?50.585549] ch943x_spi spi2.0: ch943x_port_write - reg:0xa4, val:0x 8
[? ?50.585582] ch943x_spi spi2.0: ch943x_set_termios
[? ?50.585613] ch943press s to set modem, z to xclear modem, g to get modem,b t_o send break, w to write, r tos read, q for quit.
pi spi2.0: parity = none
[? ?50.585759] ch943x_spi spi2.0: ch943x_port_write - reg:0xa3, val:0x 3
[? ?50.585790] ch943x_spi spi2.0: ch943x_set_termios disable rts/cts
[? ?50.585969] ch943x_spi spi2.0: ch943x_port_read - reg:0x24, val:0x 8
[? ?50.586117] ch943x_spi spi2.0: ch943x_port_write - reg:0xa4, val:0x 8
[? ?50.586148] ch943x_spi spi2.0: ch943x_set_baud - 9600
[? ?50.586295] ch943x_spi spi2.0: ch943x_port_read - reg:0x23, val:0x 3
[? ?50.586443] ch943x_spi spi2.0: ch943x_port_write - reg:0xa3, val:0x80
[? ?50.586589] ch943x_spi spi2.0: ch943x_port_write - reg:0xa1, val:0x 1
[? ?50.586735] ch943x_spi spi2.0: ch943x_port_write - reg:0xa0, val:0xe1
[? ?50.586879] ch943x_spi spi2.0: ch943x_port_write - reg:0xa3, val:0x 3
[? ?50.586946] ch943x_spi spi2.0: ch943x_set_mctrl - mctrl:0x6
[? ?50.586996] ch943x_spi spi2.0: ch943x_md_proc - mcr:0xb, force:0x 8
[? ?50.587108] ch943x_spi spi2.0: ch943x_port_write - reg:0xa4, val:0x b
[? ?50.587225] ch943x_spi spi2.0: ch943x_ioctl
[? ?50.587746] ch943x_spi spi2.0: ch943x_ioctl
[? ?50.587975] ch943x_spi spi2.0: ch943x_ioctl
[? ?50.588019] ch943x_spi spi2.0: ch943x_ioctl
[? ?50.588055] ch943x_spi spi2.0: ch943x_set_termios
[? ?50.588080] ch943x_spi spi2.0: parity = none
[? ?50.588275] ch943x_spi spi2.0: ch943x_port_write - reg:0xa3, val:0x 3
[? ?50.588310] ch943x_spi spi2.0: ch943x_set_termios disable rts/cts
[? ?50.588461] ch943x_spi spi2.0: ch943x_port_read - reg:0x24, val:0x b
[? ?50.588619] ch943x_spi spi2.0: ch943x_port_write - reg:0xa4, val:0x b
[? ?50.588650] ch943x_spi spi2.0: ch943x_set_baud - 115200
[? ?50.588794] ch943x_spi spi2.0: ch943x_port_read - reg:0x23, val:0x 3
[? ?50.588982] ch943x_spi spi2.0: ch943x_port_write - reg:0xa3, val:0x80
[? ?50.589134] ch943x_spi spi2.0: ch943x_port_write - reg:0xa1, val:0x 0
[? ?50.589279] ch943x_spi spi2.0: ch943x_port_write - reg:0xa0, val:0x28
[
發(fā)送數(shù)據(jù)日志:
w
[? 130.568970] ch943x_spi spi2.0: ch943x_start_tx
[? 130.569024] chwrote 256 bytes already.
press s to set modem, z to clear modem, g to get modem,b to send bre94ak, w to write, r to read, q f3or quit.
x_spi spi2.0: ch943x_start_tx schedule
[? 130.570148] ch943x_spi spi2.0: ch943x_wq_proc
[? 130.570300] ch943x_spi spi2.0: ch943x_port_read - reg:0x21, val:0x d
[? 130.570408] ch943x_spi spi2.0: ch943x_port_write - reg:0xa1, val:0x f
[? 130.570495] ch943x_spi spi2.0: ch943x_ist interrupt enter...
[? 130.570618] ch943x_spi spi2.0: ch943x_port_read - reg:0x 5, val:0x60
[? 130.570727] ch943x_spi spi2.0: ch943x_port_read - reg:0x 2, val:0x 1
[? 130.570760] ch943x_spi spi2.0: ch943x_port_irq no int, quit
[? 130.570867] ch943x_spi spi2.0: ch943x_port_read - reg:0x15, val:0x60
[? 130.571120] ch943x_spi spi2.0: ch943x_port_read - reg:0x12, val:0x 1
[? 130.571150] ch943x_spi spi2.0: ch943x_port_irq no int, quit
[? 130.571245] ch943x_spi spi2.0: ch943x_port_read - reg:0x25, val:0x60
[? 130.571340] ch943x_spi spi2.0: ch943x_port_read - reg:0x22, val:0xc2
[? ?92.298165] ch943x_spi spi2.0: ch943x_handle_tx
[? ?92.298203] ch943x_spi spi2.0: ch943x_handle_tx 256 bytes
[? ?92.298296] ch943x_spi spi2.0: ch943x_raw_write - reg:0xa0
[? ?92.298326] ch943x_spi spi2.0:? ? ? ?buf[0]:0x 0
[? ?92.298417] ch943x_spi spi2.0: ch943x_raw_write - reg:0xa0
[? ?92.298447] ch943x_spi spi2.0:? ? ? ?buf[0]:0x 1
..........
[? ?92.299434] ch943x_spi spi2.0:? ? ? ?buf[0]:0x 9
[? ?92.299555] ch943x_spi spi2.0: ch943x_raw_write - reg:0xa0
[? ?92.299588] ch943x_spi spi2.0:? ? ? ?buf[0]:0x a
[? ?92.299695] ch943x_spi spi2.0: ch943x_raw_write - r
press s to set modem, z eto clear modem, g to get modem,b to send break, w to gwrite, r to read, q for quit.
:0xa0
[? ?92.299726] ch943x_spi spi2.0:? ? ? ?buf[0]:0x b
.......
[? ?92.326685] ch943x_spi spi2.0: ch943x_raw_write - reg:0xa0
[? ?92.326700] ch943x_spi spi2.0:? ? ? ?buf[0]:0xfe
[? ?92.326772] ch943x_spi spi2.0: ch943x_raw_write - reg:0xa0
[? ?92.326786] ch943x_spi spi2.0:? ? ? ?buf[0]:0xff
[? ?92.326863] ch943x_spi spi2.0: ch943x_port_read - reg:0x25, val:0x 0
[? ?92.326954] ch943x_spi spi2.0: ch943x_port_read - reg:0x22, val:0xc2
[? ?92.326968] ch943x_spi spi2.0: ch943x_handle_tx
[? ?92.326979] ch943x_spi spi2.0: ch943x_handle_tx stopped
[? ?92.327055] ch943x_spi spi2.0: ch943x_port_read - reg:0x21, val:0x f
[? ?92.327131] ch943x_spi spi2.0: ch943x_port_write - reg:0xa1, val:0x d
[? ?92.327205] ch943x_spi spi2.0: ch943x_port_read - reg:0x25, val:0x60
[? ?92.327278] ch943x_spi spi2.0: ch943x_port_read - reg:0x22, val:0xc1
[? ?92.327291] ch943x_spi spi2.0: ch943x_port_irq no int, quit
[? ?92.327366] ch943x_spi spi2.0: ch943x_port_read - reg:0x35, val:0x60
[? ?92.327439] ch943x_spi spi2.0: ch943x_port_read - reg:0x32, val:0x 2
[? ?92.327451] ch943x_spi spi2.0: ch943x_handle_tx
[? ?92.327462] ch943x_spi spi2.0: ch943x_handle_tx stopped
[? ?92.327536] ch943x_spi spi2.0: ch943x_port_read - reg:0x31, val:0x 0
[? ?92.327610] ch943x_spi spi2.0: ch943x_port_write - reg:0xb1, val:0x 0
[? ?92.327683] ch943x_spi spi2.0: ch943x_port_read - reg:0x35, val:0x60
[? ?92.327758] ch943x_spi spi2.0: ch943x_port_read - reg:0x32, val:0x 1
[? ?92.327769] ch943x_spi spi2.0: ch943x_port_irq no int, quit
[? ?92.327780] ch943x_spi spi2.0: ch943x_ist end
[? ?92.327793] ch943x_spi spi2.0: ch943x_ist interrupt enter...
[? ?92.327867] ch943x_spi spi2.0: ch943x_port_read - reg:0x 5, val:0x60
[? ?92.327942] ch943x_spi spi2.0: ch943x_port_read - reg:0x 2, val:0x 1
[? ?92.327955] ch943x_spi spi2.0: ch943x_port_irq no int, quit
[? ?92.328030] ch943x_spi spi2.0: ch943x_port_read - reg:0x15, val:0x60
[? ?92.328104] ch943x_spi spi2.0: ch943x_port_read - reg:0x12, val:0x 1
[? ?92.328115] ch943x_spi spi2.0: ch943x_port_irq no int, quit
[? ?92.328190] ch943x_spi spi2.0: ch943x_port_read - reg:0x25, val:0x60
[? ?92.328262] ch943x_spi spi2.0: ch943x_port_read - reg:0x22, val:0xc1
[? ?92.328272] ch943x_spi spi2.0: ch943x_port_irq no int, quit
[? ?92.328344] ch943x_spi spi2.0: ch943x_port_read - reg:0x35, val:0x60
[? ?92.328454] ch943x_spi spi2.0: ch943x_port_read - reg:0x32, val:0x 1
[? ?92.328467] ch943x_spi spi2.0: ch943x_port_irq no int, quit
[? ?92.328478] ch943x_spi spi2.0: ch943x_ist end
接收日志:無日志。