CH9434串口只能发送不能接收,使用官方例程时RS485失能失败。

使用官方例程:tty_test_ch9434.c

1、初始化(./cdn_spi_test -D /dev/ttyWCH2 -S 115200 -v)时(波特率115200),RS485提示失能失败;

2、写数据时,串口数据可以收到数据;

3、串口发送数据时,使用例程不能获取数据,将串口的波特率改的小于115200,驱动会打印出日志,越接近115200接收的数据越准确,但是串口设置为115200驱动无反应,没有数据可以接收过来。

4、SPI时钟设置的是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

[



发送数据日志:

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





接收日志:无日志。


您好

1、RS485提示使能失败问题,需更新驱动程序;

2、CH9434串口接收时无打印日志,表明未触发中断;

3、CH9434串口小于115200bps接收,驱动会打印出日志,这里需输出日志检查寄存器状态。
已私信您。


只有登录才能回复,可以选择微信账号登录