How to debug spi communication
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
Use this solution,you will prove your SPI communication ok or not
[SOLUTION]
1、check GPIO config。
adb shell
cd /sys/devices/virtual/misc/mtgpio
cat pin
example(M6797,gpio234–gpio237,MODE1 is SPI mode):
2、Control virtual spi device which registeron platform to send message with slave
device.
adb shell
cd/sys/bus/spi/drivers/test_spi/spix.1------x confirmbyyou Pin design.For example:Use
SPI1_CLK_Bpin(MT6797),it is spi1.1.
echo -w com_mod=1 > spi------------config DMA mode(0----fifi mode,1----dma mode)
echo -w len=8 > spi_msg-------send 8byte data,default date is 0x12345678.If use -w
cmd,len value must multiple of four,for example:8,It will circulation send
0x12345678。
If pin miso and mosi is disconnect or connect but send fail,you will find next log.
If send success,you won't found.Then you can test hardware signal use oscilloscope
Use this solution,you will prove your SPI communication ok or not
[SOLUTION]
1、check GPIO config。
adb shell
cd /sys/devices/virtual/misc/mtgpio
cat pin
example(M6797,gpio234–gpio237,MODE1 is SPI mode):
2、Control virtual spi device which registeron platform to send message with slave
device.
adb shell
cd/sys/bus/spi/drivers/test_spi/spix.1------x confirmbyyou Pin design.For example:Use
SPI1_CLK_Bpin(MT6797),it is spi1.1.
echo -w com_mod=1 > spi------------config DMA mode(0----fifi mode,1----dma mode)
echo -w len=8 > spi_msg-------send 8byte data,default date is 0x12345678.If use -w
cmd,len value must multiple of four,for example:8,It will circulation send
0x12345678。
If pin miso and mosi is disconnect or connect but send fail,you will find next log.
If send success,you won't found.Then you can test hardware signal use oscilloscope