SPI PROBLEM

Started by pawnies20, June 22, 2016, 11:21:18 PM

Previous topic - Next topic

pawnies20

Hello!!
I have a problem with spi and need help, please  :)

Kernel:
Linux debian-armhf 3.4.104+ #3 PREEMPT Tue Dec 22 13:44:49 CET 2015 armv7l GNU/Linux


spi device is existing in /dev/
name: spidev2.0

fex file:

[spi2_para]
spi_used = 1
spi_cs_bitmap = 1
spi_cs0 = port:PC19<3><default><default><default>
spi_sclk = port:PC20<3><default><default><default>
spi_mosi = port:PC21<3><default><default><default>
spi_miso = port:PC22<3><default><default><default>

[spi_devices]
spi_dev_num = 1

[spi_board0]
modalias = "spidev"
max_speed_hz = 1000000
bus_num = 2
chip_select = 0
mode = 0
full_duplex = 0
manual_cs = 0


when using well known commmand:./spidev_test -D /dev/spidev2.0

result is:

spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)

FF FF FF FF FF FF
40 00 00 00 00 95
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
DE AD BE EF BA AD
F0 0D


Result is ok BUT i ve no making a loop beetwen miso and mosi  !!!!!!

It's not a joke !!!

when i make a loop with a cable beetwen mosi and miso : same result! !!!!!

Arghhhhhhh

When using ./spidev_fdx -m 2 -r 2 /dev/spidev2.0  (full duplex version)

Result with and without loop is:

/dev/spidev2.0: spi mode 0, 8 bits per word, 500000 Hz max
response( 2,  3):  00 00
read( 2,  2): 00 00,
root@debian-armhf:/home/sunxi-tools#


Weird dream????

With oscilloscope i can see signals.

IN logs i can see:


[  436.931307] [spi]: drivers/spi/spi_sunxi.c(L1025) cpu tx data time out!
[  454.788298] spidev spi2.0: setup mode 0, 8 bits/w, 500000 Hz max --> 0
[  454.800343] spidev spi2.0: spi mode 00
[  454.811568] spidev spi2.0: setup mode 0, 8 bits/w, 500000 Hz max --> 0
[  454.823540] spidev spi2.0: 8 bits per word
[  454.835322] spidev spi2.0: setup mode 0, 8 bits/w, 500000 Hz max --> 0
[  454.847309] spidev spi2.0: 500000 Hz (max)
[  455.031084] [spi]: drivers/spi/spi_sunxi.c(L1025) cpu tx data time out!
[  680.087546] spidev spi2.0: setup mode 0, 8 bits/w, 500000 Hz max --> 0
[  680.099580] spidev spi2.0: spi mode 00
[  680.110889] spidev spi2.0: setup mode 0, 8 bits/w, 500000 Hz max --> 0
[  680.122901] spidev spi2.0: 8 bits per word
[  680.134806] spidev spi2.0: setup mode 0, 8 bits/w, 500000 Hz max --> 0
[  680.146723] spidev spi2.0: 500000 Hz (max)
[  680.327421] [spi]: drivers/spi/spi_sunxi.c(L1025) cpu tx data time out!
[  808.524979] spidev spi2.0: setup mode 0, 8 bits/w, 500000 Hz max --> 0
[  808.536840] spidev spi2.0: spi mode 00
[  808.548343] spidev spi2.0: setup mode 0, 8 bits/w, 500000 Hz max --> 0
[  808.560174] spidev spi2.0: 8 bits per word
[  808.572042] spidev spi2.0: setup mode 0, 8 bits/w, 500000 Hz max --> 0
[  808.583887] spidev spi2.0: 500000 Hz (max)
[  808.764938] [spi]: drivers/spi/spi_sunxi.c(L1025) cpu tx data time out!


Thanx

pawnies20

Some news:

It works but i must use flag -l.

Very very strange!!


With no loopback beetween mosi and miso:

root@debian-armhf:/home/sunxi-tools# ./spidev_test -D /dev/spidev2.0 -l
spi mode: 32
bits per word: 8
max speed: 500000 Hz (500 KHz)

00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00

With loopback beetween mosi and miso:

root@debian-armhf:/home/sunxi-tools# ./spidev_test -D /dev/spidev2.0 -l
spi mode: 32
bits per word: 8
max speed: 500000 Hz (500 KHz)

FF FF FF FF FF FF
40 00 00 00 00 95
FF FF FF FF FF FF
FF FF FF FF FF FF
FF FF FF FF FF FF
DE AD BE EF BA AD