1 1
renky

orang pi one enable spi

Recommended Posts

orange pi one

armbian buster

purged non free software

 

I installed flashrom.

In sudo armbian-config -> system settings -> toogle hardware I

marked spi-spidev. Saved. Restarted computer.

 

/dev/spi* displays nothing.

How can I enable spi in armbian?

Thank you.

Share this post


Link to post
Share on other sites
On 1/30/2020 at 12:17 PM, renky said:

How can I enable spi in armbian?

you need the following in /boot/armbianEnv.txt and running a CURRENT or DEV kernel (not Legacy) :

overlays=spi-spidev
param_spidev_spi_bus=0

EDIT : Fix my own typo : should be "param_spidev_spi_bus=0" instead of "param_spinor_spi_bus=0"

Share this post


Link to post
Share on other sites
Quote

running a CURRENT

 

I installed newest armbian buster having version

5.4.14-sunxi.

Is that current or not legacy?

 

Armbianenvtxt is

verbosity=1
logo=disabled
console=both
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
rootdev=UUID=
rootfstype=ext4
overlays=spi-spidev
param_spinor_spi_bus=0
usbstoragequirks=

 

It does not work.

Command

sudo ls -l /dev/spi*

returns

ls: cannot access '/dev/spi*': No such file or directory

 

On raspberry pi you enable spi this way

https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md

Share this post


Link to post
Share on other sites
14 minutes ago, renky said:

5.4.14-sunxi.

Is that current?

Yes !

 

14 minutes ago, renky said:

It does not work.

You need to debug more :

- check that overlay is actually loaded during the u-boot phase. (Did you rebooted since the /boot/armbianEnv.txt changes ?)

- do a "dmesg | grep -i spi" to figure out about any errors, (maybe pins are used elsewhere ?)

 

14 minutes ago, renky said:

On raspberry pi you enable spi this way

Forget about this way, it is not Armbian way ... :P

 

EDIT: Oh ! I didn't look thoroughly : You wrote "param_spinor_spi_bus=0" instead of "param_spidev_spi_bus=0" because of my own typo done previously ... :lol:

Share this post


Link to post
Share on other sites

Thank you.

After I corrected the code, it might work. Command

sudo ls -l /dev/spi*

returns

crw------- 1 root root 153, 0 jan 30 /dev/spidev0.0

 

Are there commands such that you can verify if spi has set?

mosi

miso

ceo_n

sclk

 

On a raspberry pi 0 command

sudo ls -l /dev/spi*

returns

crw-rw----1 root spi 153, 0 jan 30 /dev/spidev0.0

crw-rw----1 root spi 153, 1 jan 30 /dev/spidev0.1

 

On orange pi one it says crw. On raspberry pi 0 it says crw-rw. A raspberry pi

0 can flash the flashchip of a thinkpad t400. Can the orange pi one do it, if

the orange pi one's spi says crw and not crw-rw?

Share this post


Link to post
Share on other sites
34 minutes ago, renky said:

Are there commands such that you can verify if spi has set?

What do you mean ?

34 minutes ago, renky said:

On orange pi one it says crw. On raspberry pi 0 it says crw-rw. A raspberry pi

0 can flash the flashchip of a thinkpad t400. Can the orange pi one do it, if

the orange pi one says crw and not crw-rw?

As long as you are executing as "root", you don't need to have "crw-rw" flags ...

Share this post


Link to post
Share on other sites
Quote

What do you mean ?

 

How you can test if spi will work. On libreboot's homepage this test

command is displayed:

./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512

It should return

Calibrating delay loop... OK. No EEPROM/flash device found. Note: flashrom can never write if the flash chip isn't found automatically.

 

./flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512

does not work on the raspberry pi 0 and orange pi one.

It returns

No such file or directory

flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512

returns

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
No EEPROM/flash device found.
Note: flashrom can never write if the flash chip isn't found automatically.

on both the raspberry pi 0 and orange pi one. Since the

raspberry pi 0 can flash the flashchip of a thinkpad t400 then

maybe the orange pi one also can flash it. Because both

return the same message from

flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512

Share this post


Link to post
Share on other sites
31 minutes ago, renky said:

How you can test if spi will work.

The simpliest way is to test MOSI/MISO with a loopback wire between those two pins and then use "spidev_test" after having it compiled :

https://github.com/torvalds/linux/blob/master/tools/spi/spidev_test.c

 

37 minutes ago, renky said:

No EEPROM/flash device found.

 

Did you properly connected a SPINOR flash chip on the proper pins or you connected some other kind of devices ?

Share this post


Link to post
Share on other sites
Quote

connected a SPINOR flash chip

 

Nothing was connected. You are supposed to run command

flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512

with nothing connected. And if it returns

Calibrating delay loop... OK. No EEPROM/flash device found. Note: flashrom can never write if the flash chip isn't found automatically.

then there is a chance that spi works on the computer.

Like I wrote, on the raspberry pi 0 it returns

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
No EEPROM/flash device found

Still the raspberry pi 0 was able to flash the

flashchip.

 

Share this post


Link to post
Share on other sites
3 hours ago, renky said:

Nothing was connected.

If nothing connected, it is pretty normal that "flashrom" gives an error since it doesn't find any answers to it JEDEC ID request ...

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
1 1