@yuzukitsuru 谢谢大侠回复
# echo 255 > /sys/module/spi_sunxi/parameters/debug
# spidev_test -D /dev/spidev0.0 -v -s 1000000 -p 12345678
[ 96.048082] spi_set_clk()532 - set spi clock 100000000, mclk 1000000
[ 96.055418] spi_set_clk()532 - set spi clock 100000000, mclk 100000000
[ 96.062767] spi_set_clk()532 - set spi clock 1000000, mclk 100000000
spi mode: 0x0[ 96.071087] sunxi_spi_transfer_one()1637 - [spi0] begin transfer, txbuf 684e7dd8, rxbuf 989b57fc, len 8
bits per word: 8
max speed: 1000000 Hz (1000 KHz)
[ 96.083098] sunxi_spi_mode_check()1313 - [spi0] Single mode Full duplex tx & rx
[ 96.095818] sunxi_spi_transfer_one()1674 - [spi0] dump reg:
[ 96.102085] 0x04025000: 00010001 00000083 00002044 00000000
[ 96.108655] 0x04025010: 00001700 00000032 00200020 00000000
[ 96.115268] 0x04025020: 00000000 00000002 00002000 00000000
[ 96.121632] 0x04025030: 00000008 00000008 00000008 00000000
[ 96.128206] sunxi_spi_dma_transfer()1551 - [spi0] rx and tx -> by ahb
[ 96.135668] sunxi_spi_cpu_writel()1417 - t->len = 8
[ 96.141155] 000: 31 32 33 34 35 36 37 38
[ 96.145935] sunxi_spi_cpu_readl()1386 - t->len = 8
[ 96.145945] sunxi_spi_handler()1728 - [spi0] irq status = 1033
[ 96.157855] sunxi_spi_handler()1744 - [spi0] SPI TC comes
[ 96.164245] 000: ff ff ff ff ff ff ff ff
[ 96.168751] sunxi_spi_transfer_one()1685 - [spi0] dump reg:
[ 96.175279] 0x04025000: 00010001 00000083 00002044 00000000
[ 96.181640] 0x04025010: 00000000 00000032 00200020 00000000
[ 96.188197] 0x04025020: 00000000 00000002 00002000 00000000
[ 96.194687] 0x04025030: 00000000 00000000 00000000 00000000
TX | 31 32 33 34 35 36 37 38 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | 12345678
RX | FF FF FF FF FF FF FF FF __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | ........
重复几十次测试,没有卡住, 我就要下面命令加大收发数据量,也不会卡住
spi-pipe --device=/dev/spidev0.0 -b 8 -n 256 -s 1000000 < /dev/zero
然后我再把调试关闭,重复几次,很快就复现原来的问题
# echo 0 > /sys/module/spi_sunxi/parameters/debug
# spidev_test -D /dev/spidev0.0 -v -s 1000000 -p 12345678
spi mode: 0x0
bits per word: 8
max speed: 1000000 Hz (1000 KHz)
TX | 31 32 33 34 35 36 37 38 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | 12345678
RX | FF FF FF FF FF FF FF FF __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | ........
# spidev_test -D /dev/spidev0.0 -v -s 1000000 -p 12345678
spi mode: 0x0
bits per word: 8
max speed: 1000000 Hz (1000 KHz)
TX | 31 32 33 34 35 36 37 38 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | 12345678
RX | FF FF FF FF FF FF FF FF __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | ........
# spidev_test -D /dev/spidev0.0 -v -s 1000000 -p 12345678
spi mode: 0x0
bits per word: 8
max speed: 1000000 Hz (1000 KHz)
TX | 31 32 33 34 35 36 37 38 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | 12345678
RX | FF FF FF FF FF FF FF FF __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | ........
# spidev_test -D /dev/spidev0.0 -v -s 1000000 -p 12345678
spi mode: 0x0
bits per word: 8
max speed: 1000000 Hz (1000 KHz)
TX | 31 32 33 34 35 36 37 38 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | 12345678
RX | FF FF FF FF FF FF FF FF __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ | ........
# spidev_test -D /dev/spidev0.0 -v -s 1000000 -p 12345678
spi mode: 0x0
bits per word: 8
max speed: 1000000 Hz (1000 KHz)
卡住了,后面没有输出了
我用示波器观察,最后一次卡住时,也是有波形的,感觉spi的驱动没有收到传输结束中断,调试输出可能会影响到中断的设置时序,请大侠帮助分析分析,谢谢!
在T113/D1s上都可以重现,我对比了一下它们驱动sunxi_spi.c是相同的
T113的软件版本
https://gitee.com/weidongshan/buildroot_100ask_t113-pro