SPI not working on C1+ & Ubuntu 16.04

Moderators: mdrjr, odroid

SPI not working on C1+ & Ubuntu 16.04

Unread postby pietruzzo » Mon May 08, 2017 11:18 am

Hello folks. I have owned this OC1+ for quite awhile now, however I never had the need to use SPI with it. I must to admit that I don't quite know much about how SPI works and electronic in general.

It all started few weeks ago when I decided to flash coreboot onto my ThinkPad x230. I have installed WiringPI system wide and from the hardkernel github, and supposedly gpio readall shows me the pinout layout along whit what each pin does what.

However though, I have never got to read the x230's BIOS chip. Initially I thought I was doing something wrong. I have spent days behind this, revising pinouts, swapping wires, getting 10cm short wires, making sure the pomona clip was making good contact with the chip, lowering communication frequency but nothing, none of that I tried worked.

I became suspicious that the issue might actually be with the odroid c1+ itself when I ran then spidev_test. Here is spidev_test's results.

Code: Select all
pietro@odroid:~$ sudo ./spidev_test -D /dev/spidev0.0 -s 1000000 -b 8
spi mode: 0
bits per word: 8
max speed: 1000000 Hz (1000 KHz)

FF FF FF FF
pietro@odroid:~$ sudo ./spidev_test -D /dev/spidev0.0 -s 1000000 -b 16
spi mode: 0
bits per word: 16
max speed: 1000000 Hz (1000 KHz)

FF FF FF FF
pietro@odroid:~$ sudo ./spidev_test -D /dev/spidev0.0 -s 1000000 -b 32
spi mode: 0
bits per word: 32
max speed: 1000000 Hz (1000 KHz)

FF FF FF FF
pietro@odroid:~$ sudo ./spidev_test -D /dev/spidev0.0 -s 1000000 -b 32
spi mode: 0
bits per word: 32
max speed: 1000000 Hz (1000 KHz)

FF FF FF FF
pietro@odroid:~$ sudo ./spidev_test -D /dev/spidev0.0 -s 1000000 -b 32 -H
spi mode: 1
bits per word: 32
max speed: 1000000 Hz (1000 KHz)

FF FF FF FF
pietro@odroid:~$ sudo ./spidev_test -D /dev/spidev0.0 -s 1000000 -b 32 -O
spi mode: 2
bits per word: 32
max speed: 1000000 Hz (1000 KHz)

FF FF FF FF
pietro@odroid:~$ sudo ./spidev_test -D /dev/spidev0.0 -s 1000000 -b 32 -H -O
spi mode: 3
bits per word: 32
max speed: 1000000 Hz (1000 KHz)

FF FF FF FF
pietro@odroid:~$


As you can see the tests result is always the same FF FF FF FF, and I am not sure this is how it is supposed to be.

I do appreciate some help in getting this sorted. As mentioned above I am using Ubuntu 16.04.2 LTS built for the Odroid C family. However, I am willing to go with whatever will get me SPI working.

Thanks
pietruzzo
 
Posts: 3
Joined: Mon May 08, 2017 10:55 am
languages_spoken: Italian, English, Spanish
ODROIDs: C1+

Re: SPI not working on C1+ & Ubuntu 16.04

Unread postby odroid » Mon May 08, 2017 12:00 pm

Disconnect your Thinkpad from C1+ and tie the MOSI and MISO pins to try a loopback test.
User avatar
odroid
Site Admin
 
Posts: 24342
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: SPI not working on C1+ & Ubuntu 16.04

Unread postby pietruzzo » Mon May 08, 2017 12:18 pm

odroid wrote:Disconnect your Thinkpad from C1+ and tie the MOSI and MISO pins to try a loopback test.


Hey thanks for answering. I am sorry for the noob question, but how would I do that?
pietruzzo
 
Posts: 3
Joined: Mon May 08, 2017 10:55 am
languages_spoken: Italian, English, Spanish
ODROIDs: C1+

Re: SPI not working on C1+ & Ubuntu 16.04

Unread postby odroid » Mon May 08, 2017 12:24 pm

Connect Pin#19 and Pin#21 with a jumper wire.
http://odroid.com/dokuwiki/doku.php?id= ... are_spidev

You can read back the sent data from MOSI to MISO.
User avatar
odroid
Site Admin
 
Posts: 24342
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: SPI not working on C1+ & Ubuntu 16.04

Unread postby pietruzzo » Wed May 10, 2017 10:20 am

odroid wrote:Connect Pin#19 and Pin#21 with a jumper wire.
http://odroid.com/dokuwiki/doku.php?id= ... are_spidev

You can read back the sent data from MOSI to MISO.


Okay but, do I have to connect MISO to MOSI using the same wire on the odroid board? Once done that do I have to go ahead and repeat the spidev_test again?

Thanks
pietruzzo
 
Posts: 3
Joined: Mon May 08, 2017 10:55 am
languages_spoken: Italian, English, Spanish
ODROIDs: C1+

Re: SPI not working on C1+ & Ubuntu 16.04

Unread postby odroid » Wed May 10, 2017 10:46 am

Yes. We call it loopback test.
User avatar
odroid
Site Admin
 
Posts: 24342
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID


Return to Hardware and peripherals

Who is online

Users browsing this forum: No registered users and 2 guests