Orange Pi i96 Getting Started Guide

Orange Pi i96
Orange Pi i96

Recently I reviewed the Orange Pi Zero 2 and thought it was a fantastic board. I really like the amount of polish that the Orange Pi line of products have as it is the closest I have seen to anything approaching a Raspberry Pi experience. We also benchmarked the Orange Pi Zero 2 and determined it’s a very capable board.

I recently got a Orange Pi i96 (thanks munecito!) and this board is very exciting because it was purchased on sale for ~$10! That is insanely cheap. The reason it’s so cheap is because it’s a headless board that doesn’t contain any display-out ports.

If you are going to be using the board headless anyway (I use most of my SBCs headlessly) you may be able to save a fortune with this board. Let’s get started!

Hardware Used

Orange Pi i96
Orange Pi i96

The Orange Pi i96 is a low-cost board from the Orange Pi line of SBCs. It uses the RDA8810 SoC and has 256MB LPDDR2 SDRAM. It’s well suited for headless tasks and is astonishingly cheap.

Links: Amazon.com*, AliExpress.com*, Amazon.ca*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*, Amazon.sg*

Geekworm Copper Heatsink Set
Geekworm Copper Heatsink Set

The Geekworm copper heatsink set is designed to fit many different single board computers. It uses thermal conductive adhesive which many “cheap” heatsink kits for SBCs don’t have. Eliminates hotspots and reduces throttling. Can be further enhanced by powered cooling over the heatsinks.

Links: Amazon.com*, Amazon.ca*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*

Orange Pi Wireless Mouse
Orange Pi Wireless Mouse

The Orange Pi official mouse uses 2.4GHz wireless to give you a wireless mouse experience with the Orange Pi

Links: Amazon.com*, AliExpress*

Orange Pi Portable Monitor
Orange Pi Portable Monitor

The Orange Pi monitor is meant to be a portable monitor you can take anywhere. It has a resolution of 1080P and features a hinge in the back that folds out to support the monitor.

Links: Amazon.com*, AliExpress*

Getting Started

EDIT: I now recommend using my fixed Orange Pi i96 image as it will fix your USB port to be able to operate at full speed and give you a much newer OS of Debian Bullseye.

Alternatively you may use the official images (not recommended for this board). If you’d like to use the official images instead head to the official Orange Pi downloads page:

Orange Pi - Official Downloads Page
Orange Pi – Official Downloads Page

Now select the Orange Pi i96 from the list. I will be using Ubuntu Linux for this guide but you may use Armbian as well.

If you are wanting to try Android I highly recommend seeing my Orange Pi Android Installation Guide as the installation process is different than Linux.

Writing the Image

The images are typically distributed as a .tar.gz file. The name of the Ubuntu image tar.gz file at time of writing was OrangePi_i96_ubuntu_xenial_server_linux3.10.62_v0.0.4.tar.gz.

We will need to extract this file. If you are using Windows then grab 7-zip to be able to extract a .tar.gz file.

Inside this file will be a .img file. Since I downloaded the Ubuntu image the name of my file was OrangePi_i96_ubuntu_xenial_server_linux3.10.62_v0.0.4.img. This is the image that we are going to write to our SD card.

There are several choices to write the image to your SD card. If you are on Windows I recommend Win32DiskImager. Etcher is also available for Windows/Linux/Mac OS X.

Write the image to the SD card using your preferred software.

First Startup

Before starting up you should make sure that the Orange Pi’s switches are in these positions (indicating to boot from SD card):

Orange Pi - SD Startup Position
Orange Pi – SD Startup Position
Orange Pi - SD Startup Position
Orange Pi – SD Startup Position

We’re ready to put the SD card into the Orange Pi i96. But how are we going to connect to the device? There’s no network port and the device isn’t configured to connect to our WiFi yet.

Connection Option #1

If you happen to have a USB to Ethernet adapter that is the easiest way to connect to the device for initial configuration:

USB to Ethernet Adapter
USB to Ethernet Adapter

Connection Option #2

If you have a TTL to USB serial debug adapter* you can use that as well. See the OrangePi instructions for that method.

Initial Configuration

orangepi-config Utility

Once you’ve connected it’s time to do some basic configuration. We will use the tool orangepi-config:

sudo orangepi-config

You may now set the WiFi settings, etc. The orangepi-config is just like raspi-config if you’ve ever used that on a Raspberry Pi.

Don’t reboot before doing the next section.

Fix Second Startup (Debian / Ubuntu)

You will notice if you reboot the device it will often not come up the second startup. This is especially likely if you performed a sudo apt dist-upgrade.

To prevent this I recommend removing the alsautils package. This will impact sound functionality on the board but as I was not using it and intended to use this more as a headless board this was fine for me.

sudo apt purge alsa-utils

If you need to have the sound working on the board there is an alternate solution available here.

This is not necessary in my Legendary image as it has kernel fixes for these issues (highly recommended)

Set Timezone

Replace my timezone with yours in the following commands:

rm /etc/localtime
ln -s /usr/share/zoneinfo/America/Denver /etc/localtime

Setup Locales

Setting the locales isn’t in orangepi-config (such as it is in raspi-config) but here’s a quick way to set them:

sudo apt install locales -y
sudo dpkg-reconfigure locales

Setup Wireless CRDA Regulatory Domain

For the wireless to function very well at all you need to set the wireless regulatory domain.

If you are not using my image then you will first need to install the crda package with:

sudo apt install crda -y

Now we can set the regulatory domain by editing the following file:

sudo nano /etc/default/crda

At the bottom of the file there is this line:

REGDOMAIN=

Put the 2 letter country code for your country. Mine is “US”. Once finished press Ctrl+X then Y to save the file.

Optional – Upgrade Debian OS to Buster/Bullseye

Note that this will not upgrade the kernel. You can upgrade everything else though including all the way up to Bullseye. You should do this one release at a time and start with “Stretch” and then do “Bullseye” afterward.

If you are using the Debian installation you can upgrade to Buster by editing your /etc/apt/sources.list file.

Change all instances of “stretch” in the file to “buster” and then do the following:

sudo apt update && sudo apt dist-upgrade -y

Once this has completed reboot the system (make sure you’ve done my fix second reboot section first by purging alsa-utils). Verify you are on Buster with

cat /etc/os-release

for example:

root@orangepii96:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Now you can upgrade to Bullseye. It’s almost the same as upgrading from Stretch to Buster but there has been a change in the security updates server format. Here is a working “Bullseye” apt sources file for the Debian Orange Pi i96 image:

root@orangepii96:/# cat /etc/apt/sources.list
deb http://ftp.debian.org/debian bullseye main contrib non-free
#deb-src http://ftp2.cn.debian.org/debian bullseye main contrib non-free
deb http://ftp.debian.org/debian bullseye-updates main contrib non-free
#deb-src http://ftp2.cn.debian.org/debian bullseye-updates main contrib non-free

deb http://security.debian.org/ bullseye-security main contrib non-free
#deb-src http://security.debian.org/ bullseye-security main contrib non-free

Once you’ve changed the files do a sudo apt update and make sure you don’t see any errors. If everything looks okay start the Bullseye upgrade with:

sudo apt full-upgrade -y

After a reboot you should be on Bullseye! We can verify this with cat /etc/os-release:

orangepi@orangepii96:~$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
orangepi@orangepii96:~$ uname -a 
Linux orangepii96 3.10.62-rel5.0.2+ #4 PREEMPT Wed Mar 18 18:49:25 CST 2020 armv7l GNU/Linux

Notice that the kernel has not changed at all (as cautioned at the beginning of the section) but everything else on the system will be Bullseye!

Performance Benchmarking

I benchmarked the board using a SanDisk Extreme SD card on my Pi Benchmarks web site. This gives us comparable results between boards and there are over 30,000 benchmarks submitted for various boards / storage devices.

I had a total score of 497. This was below average or off from an average Raspberry Pi setup by about 47%.

To be clear the storage performance on the board is relatively low compared to the Orange Pi Zero 2 or a Raspberry Pi (Zero or 4). That is to be expected for a price of around ~$7-$10.

I’m not sure I would say this is a disappointing result though. We are talking about a board that is a single digit number of dollars. For the price point that is fantastic performance! In fact for the price point it’s a wonder that it works at all.

Conclusion

It’s a great board. At a price point of $7-$10 it reminds me of the really, really old Raspberry Pi Zero days where you could actually get a Raspberry Pi for around that price point.

The Zero 2 is a significantly more powerful board. It benchmarked much higher than the i96 but it also costs significantly more. If you need more power that board will be a better choice. If you’ve never had an Orange Pi before I would recommend the Zero 2 first as this board is quite a bit trickier and has more outdated software available for it.

The version of Ubuntu on this board is also quite old (Ubuntu 16.04 / Xenial) compared to the Orange Pi Zero 2 which is actually running a modern 5.X kernel whereas this one is a 3.X kernel. Make sure that is not going to be a problem or you will want to step up to a higher Orange Pi. The i96 is definitely meant for simple services / projects that don’t need a lot of power. It’s perfect for those.

If you need a headless board then the Orange Pi i96 may very well fit the bill for you, the price is certainly right! Don’t skip the heatsinks though. It got very warm during testing (warm enough to freeze once during consecutive benchmarks) and Orange Pis are known to get quite hot!

Other Resources

I highly recommend using the Legendary i96 Debian Bullseye image available here

I’ve also reviewed the Orange Pi portable monitor here

Don’t miss my Orange Pi Zero 2 Review / Tips / Guide for another great board (with display connections)

I’ve also reviewed the Orange Pi 3 LTS which is roughly equivalent in power to a 2GB Pi 4

If you’re trying to set up Android definitely see my Orange Pi Android Installation Guide

For the fastest storage options check out my Linux storage benchmarking script

Subscribe
Notify of
guest

370 Comments
Inline Feedbacks
View all comments
Roberto
Roberto
2 years ago

For anyone who hasn’t bought a usb hub for their i96: eBay Link

Roberto
Roberto
2 years ago

Hello. I don’t know yet. The usb hub will arrive to me early next week

Marco
Marco
2 years ago
Reply to  Roberto

it propably wont work, you can go thru the comments and see that some already tried to use a hub, it failed.

Roberto
Roberto
2 years ago

Hello 🙂 Thank you for making this updated Debian image…
Have you tried including the 5.6.2 kernel? The people in this thread say it is working.

Roberto
Roberto
2 years ago

Thank you for your reply… I will stick with the 3.10 kernel to continue my project….

Roberto
Roberto
2 years ago
Reply to  Roberto

I found why ping needs sudo…solution

Isaac
Isaac
2 years ago

Hey – just a note. The company that makes the orange pi i96 has discontinued the product and has sold all remaining quantities to other resellers at a huge discount. So no more $5.99 boards at aliexpress. 🙁 Any of the ones you see floating around on the marketplace are the last few out there where vendors are trying to make a decent return on their investment.

Isaac
Isaac
2 years ago

Oh wow – I didn’t know these were discontinued. I messaged the company because I wanted more of them, and they had sold out but had in the neighborhood of like 500 left when I last chatted with them. I bought these just by chance because I was looking for alternative hardware for projects… I picked up 4 of these (because they were so cheap), a couple of mango pis, a couple of banana pis. I was thinking to myself, hey, if my projects will work on these, I can get more. There, unfortunately, is not a reliable supply of raspberry pis… I just bought a 100 rpi w0 1.3 boards for 3k last week (good price today, horrible price 3 years ago) and I honestly don’t know when or where I’ll be able to get more when I run out.

Andy
Andy
2 years ago

The boards are no more sold at 5.99$ but you can still find them reasonably cheap at around 13$, and according to AliExpress’ site they have 3000 in stock (can’t say if that number is real, but I guess it is):

As James said, I see a lot of potential for working SBCs like the I96 even at current (higher) pricepoint.

Marco
Marco
2 years ago

Nice commits you have done lately, but still having massive wireless issues, sudden disconnects and especially if i enable bluetooth scan.
for example connect via wifi to your network and start downloading a bit file via wget, open a second ssh shell and start scanning via bluetoothctl (scan on).

cfg80211_disconnected
[ 562.800537] cfg80211: All devices are disconnected, going to restore regulatory settings
[ 562.801391] cfg80211: Restoring regulatory settings
[ 562.802001] cfg80211: Kicking the queue
[ 562.802490] cfg80211: Calling CRDA for country: DE
[ 563.056457] cfg80211: Updating information on frequency 2412 MHz with regulatory rule:
[ 563.062500] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.063415] cfg80211: Updating information on frequency 2417 MHz with regulatory rule:
[ 563.064575] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.065368] cfg80211: Updating information on frequency 2422 MHz with regulatory rule:
[ 563.069335] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.070251] cfg80211: Updating information on frequency 2427 MHz with regulatory rule:
[ 563.071350] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.074157] cfg80211: Updating information on frequency 2432 MHz with regulatory rule:
[ 563.075012] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.076293] cfg80211: Updating information on frequency 2437 MHz with regulatory rule:
[ 563.077758] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.078491] cfg80211: Updating information on frequency 2442 MHz with regulatory rule:
[ 563.079772] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.082519] cfg80211: Updating information on frequency 2447 MHz with regulatory rule:
[ 563.083312] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.084228] cfg80211: Updating information on frequency 2452 MHz with regulatory rule:
[ 563.085388] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.086120] cfg80211: Updating information on frequency 2457 MHz with regulatory rule:
[ 563.087707] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.091491] cfg80211: Updating information on frequency 2462 MHz with regulatory rule:
[ 563.092346] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.093261] cfg80211: Updating information on frequency 2467 MHz with regulatory rule:
[ 563.094238] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.095153] cfg80211: Updating information on frequency 2472 MHz with regulatory rule:
[ 563.096130] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.100036] cfg80211: Disabling freq 2484 MHz
[ 563.100463] [RDAWLAN_ERR]:: reg_notifier for intiator:3 not supported
[ 563.101562] cfg80211: Regulatory domain changed to country: DE
[ 563.102233] cfg80211: DFS Master region ETSI
[ 563.102783] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[ 563.103820] cfg80211: (2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A, 2000 mBm)
[ 563.105163] cfg80211: (5150000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2301 mBm)
[ 563.105895] cfg80211: (5250000 KHz - 5350000 KHz @ 80000 KHz), (N/A, 2000 mBm)
[ 563.110168] cfg80211: (5470000 KHz - 5725000 KHz @ 160000 KHz), (N/A, 2698 mBm)
[ 563.110900] cfg80211: (5725000 KHz - 5875000 KHz @ 80000 KHz), (N/A, 1397 mBm)
[ 563.111816] cfg80211: (5945000 KHz - 6425000 KHz @ 160000 KHz), (N/A, 2301 mBm)
[ 563.112792] cfg80211: (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm)
[ 563.114624] cfg80211: Calling CRDA to update world regulatory domain
[ 563.157592] cfg80211: Ignoring regulatory request Set by core since the driver uses its own custom regulatory domain
[ 563.158752] [RDAWLAN_ERR]:: reg_notifier for intiator:0 not supported
[ 563.160339] cfg80211: World regulatory domain updated:
[ 563.160888] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[ 563.161926] cfg80211: (755000 KHz - 928000 KHz @ 2000 KHz), (N/A, 2000 mBm)
[ 563.162719] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm)
[ 563.163635] cfg80211: (2457000 KHz - 2482000 KHz @ 20000 KHz), (N/A, 2000 mBm)
[ 563.165039] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm)
[ 563.165771] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 mBm)
[ 563.166687] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz), (N/A, 2000 mBm)
[ 563.171325] cfg80211: (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm)
[ 563.172180] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm)
[ 563.173034] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm)
[ 563.174194] cfg80211: Calling CRDA for country: DE
[ 563.214843] cfg80211: Updating information on frequency 2412 MHz with regulatory rule:
[ 563.215637] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.216552] cfg80211: Updating information on frequency 2417 MHz with regulatory rule:
[ 563.219604] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.220397] cfg80211: Updating information on frequency 2422 MHz with regulatory rule:
[ 563.221374] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.222290] cfg80211: Updating information on frequency 2427 MHz with regulatory rule:
[ 563.223754] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.224487] cfg80211: Updating information on frequency 2432 MHz with regulatory rule:
[ 563.225463] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.226379] cfg80211: Updating information on frequency 2437 MHz with regulatory rule:
[ 563.230346] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.231079] cfg80211: Updating information on frequency 2442 MHz with regulatory rule:
[ 563.232055] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.233032] cfg80211: Updating information on frequency 2447 MHz with regulatory rule:
[ 563.234497] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.235229] cfg80211: Updating information on frequency 2452 MHz with regulatory rule:
[ 563.236206] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.239440] cfg80211: Updating information on frequency 2457 MHz with regulatory rule:
[ 563.240356] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.242187] cfg80211: Updating information on frequency 2462 MHz with regulatory rule:
[ 563.242980] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.243896] cfg80211: Updating information on frequency 2467 MHz with regulatory rule:
[ 563.244873] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.248779] cfg80211: Updating information on frequency 2472 MHz with regulatory rule:
[ 563.249572] cfg80211: 2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A mBi, 2000 mBm)
[ 563.250488] cfg80211: Disabling freq 2484 MHz
[ 563.251037] cfg80211: Regulatory domain changed to country: DE
[ 563.252197] cfg80211: DFS Master region ETSI
[ 563.252502] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[ 563.253540] cfg80211: (2400000 KHz - 2483500 KHz @ 40000 KHz), (N/A, 2000 mBm)
[ 563.254455] cfg80211: (5150000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2301 mBm)
[ 563.255371] cfg80211: (5250000 KHz - 5350000 KHz @ 80000 KHz), (N/A, 2000 mBm)
[ 563.256774] cfg80211: (5470000 KHz - 5725000 KHz @ 160000 KHz), (N/A, 2698 mBm)
[ 563.261901] cfg80211: (5725000 KHz - 5875000 KHz @ 80000 KHz), (N/A, 1397 mBm)
[ 563.262756] cfg80211: (5945000 KHz - 6425000 KHz @ 160000 KHz), (N/A, 2301 mBm)
[ 563.263671] cfg80211: (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm)
[ 565.070068] [RDAWLAN_DCMD]: Connecting to 2c:3a:fd:ff:76:aa
[ 565.101623] [RDAWLAN_CFG80211]: connected. wland_bss_connect_done
[ 565.102539] [RDAWLAN_CFG80211]: Report connect result - connection succeeded

the ssh session will drop, the speed for the download will fall to almost zero and cfg80211 disconnect happens.
now i also realised that before disconnecting cfg80211 the regulation is not set (to country 00 by default).

but what bothers me the most is the sudden disconnects from cfg80211

MZA
MZA
2 years ago

Hi all,
Good news, I’ve got CAN bus working with mcp2515.
I’ve done too much things ( not all clever) to have it but now, I’ll go back to the latest Legendary kernel and do it properly again before submitting it.

MZA
MZA
2 years ago
Reply to  MZA

I96 def_config file update and devices.c have been uploaded to OrangePi-I96-Work to make CAN bus transciever MCP2515 work instead of spidev2.1 ( SPI2 CS_1) and with interrupt pin on D02 ( H26).
After kernel compilation with CAN BUS flags and device MCP251x, install can-utils package on orangepi
sudo apt-get install can-utils
bring CAN interface up with the desired bitrate
sudo ip link set can0 type can bitrate 1000000
sudo ip link set can0 up

send a frame :
cansend can0 123#DEADBEEF
see incoming frames :
candump can0
use loop mode :
sudo ip link set can0 down
sudo ip link set can0 type can bitrate 1000000 loopback on
sudo ip link set can0 up

MZA
MZA
2 years ago

Hi James,
I think that the essay with the epd uses user-land driver, I’ve tried such a driver ( it’s more an application) and no other driver has been added to the devices.c. I’ve pulled out your latest version. So it opens the /dev/spidev2.0 which uses the CS on header pin N°16. He may be using the spidev2.1 but he would have to use the other.
You can use the devices.c without activating the MCP251x flag, it will produce the two spidev(s). Any one that needs the CAN, will have to enable the flag and compile the kernel.
By the way, prices of the OrangePI have doubled, they’re now at +13 EUR excluding shipping, I missed ordering some.

Now for the CAN bus, I’m seeing RX errors with some traffic, I guess the spi-gpio is not able to deal with it, I will try to debug ASAP. Small traffic is OK.

MZA
MZA
2 years ago

Hey James,
I’ve linked the RX frame loss to bursts while having 1Mbps bitrate on the bus.
This is an already discussed topic on the net, there are some patches to avoid race conditions in the mcp251X driver that I borrowed but it did not fix the problem. It is mainly due to slow spi transfer. I tried using higher priory irq handler but I did not do the job.
I think going back another time to rda-spi driver will be the solution but I’ll try it in the future, I need to check the I2C now.

MZA
MZA
2 years ago

Hey James,
You’ll probably need to add lrzsz package to be able to transfer files with zmodem over the serial link. I use it exclusively, I could do nothing with ssh and scp over Wi-Fi. The latest improvements of the wi-fi made it some how possible but not as quick and reliable as through the serial link.

MZA
MZA
2 years ago
Reply to  MZA

/dev/i2c-2 is OK.

MZA
MZA
2 years ago

🙂 lrzsz

MB3hel
MB3hel
2 years ago

Has anyone attempted to get a WiFi hotspot working on this device? I’ve been attempting to get this working with hostapd (bullseye image version 1.20), but have been unable to get it to work.

On line 476 wland_cfg80211.c (OrangePiRDA_Kernel repo) it seems that no driver for AP mode is implemented.

However, the iw tool lists AP as a supported mode.

Supported interface modes:
* managed
* AP

Is there perhaps a different interface to work with AP mode than NL80211 that works with this device or a different kernel driver I should try that may have support for AP mode implemented? My familiarity with the low-level Linux network stack is minimal, so I’m not really sure where to go from here.

MB3hel
MB3hel
2 years ago

Hi, thanks for the info. Building as shown I’ve been able to get very similar output. However, I believe other lines in the output may be indicators of actual issues. The lines you indicated above seem to indicate something to do with SSID scanning (station mode). I don’t get these lines when I disable connection to stations when attempting to run hostapd (I just set a static ip for wlan0 in /etc/network/interfaces).

There are some other lines that are interesting though. In particular these lines (close to the top of the output)

wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Previous country code 00, new country code US
Continue interface setup after channel list update
ctrl_iface not configured!
random: Got 20/20 bytes from /dev/random
Channel list update timeout - try to continue anyway
nl80211: Regulatory information - country=00
nl80211: 2402-2472 @ 40 MHz 20 mBm
nl80211: 2457-2482 @ 40 MHz 20 mBm (no IR)
nl80211: 2474-2494 @ 20 MHz 20 mBm (no OFDM) (no IR)
nl80211: 5170-5250 @ 80 MHz 20 mBm (no IR)
nl80211: 5735-5835 @ 80 MHz 20 mBm (no IR)
nl80211: 57240-63720 @ 2160 MHz 0 mBm
nl80211: Added 802.11b mode based on 802.11g information
nl80211: Mode IEEE 802.11g: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472 2484
nl80211: Mode IEEE 802.11b: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472 2484
Completing interface initialization

This output would seem to indicate that setting the country code failed. The channel list update times out and the regulatory information still shows a null country code.

The next interesting section is near the end of the log output

nl80211: TX queue param set: queue=0 aifs=1 cw_min=3 cw_max=7 burst_time=15 --> res=-95
Failed to set TX queue parameters for queue 0.
nl80211: TX queue param set: queue=1 aifs=1 cw_min=7 cw_max=15 burst_time=30 --> res=-95
Failed to set TX queue parameters for queue 1.
nl80211: TX queue param set: queue=2 aifs=3 cw_min=15 cw_max=63 burst_time=0 --> res=-95
Failed to set TX queue parameters for queue 2.
nl80211: TX queue param set: queue=3 aifs=7 cw_min=15 cw_max=1023 burst_time=0 --> res=-95
Failed to set TX queue parameters for queue 3.

I’m not really sure what this means, but from a little googling it seems that output similar to this has shown up from time to time with various SBCs. In the cases I found of this happening the end behavior is similar to what happens on the i96, hostapd thinks the access point is enabled, but it is not seen by any other devices.

People have solved it by unblocking wlan with rfkill or properly setting country codes and in cases where that failed the solution was usually a newer / different kernel. This leads me to wonder about that first output block. If the tx queue parameter sets fail this could be due to a country code issue, since it seems that hostapd fails to set the country code.

Tracking down the root cause of the country code failing to get set is probably non-trivial. I suspect it’s due to some strange error in the cfg80211 driver for this chip.

Perhaps it is possible to set the country code in a different way? If I recall correctly, there are some country code problems with this board’s default image that are fixed by crda? I wonder if it would be possible to fix this using crda or something similar.

MB3hel
MB3hel
2 years ago

Hi again,

Thanks for the quick response and awesome work!

I don’t remember for sure if I set the country code on the 1.20 image when I was testing hostapd, however I flashed the 1.22 image and even after setting the country code it seems to have had no effect for some reason.

After I modified /etc/default/crda and rebooted, I get the following output from iw

orangepi@orangepii96:~$ cat /etc/default/crda
# Set REGDOMAIN to a ISO/IEC 3166-1 alpha2 country code so that iw(8) may set
# the initial regulatory domain setting for IEEE 802.11 devices which operate
# on this system.
#
# Governments assert the right to regulate usage of radio spectrum within
# their respective territories so make sure you select a ISO/IEC 3166-1 alpha2
# country code suitable for your location or you may infringe on local
# legislature. See
/usr/share/zoneinfo/zone.tab’ for a table of timezone
# descriptions containing ISO/IEC 3166-1 alpha2 country codes.

REGDOMAIN=US

orangepi@orangepii96:~$ sudo iw reg get
global
country 00: DFS-UNSET
(2402 – 2472 @ 40), (6, 20), (N/A)
(2457 – 2482 @ 40), (6, 20), (N/A), NO-IR
(2474 – 2494 @ 20), (6, 20), (N/A), NO-OFDM, NO-IR
(5170 – 5250 @ 80), (6, 20), (N/A), NO-IR
(5735 – 5835 @ 80), (6, 20), (N/A), NO-IR
(57240 – 63720 @ 2160), (N/A, 0), (N/A)

orangepi@orangepii96:~$ sudo iw phy phy0 reg get
global
country 00: DFS-UNSET
(2402 – 2472 @ 40), (6, 20), (N/A)
(2457 – 2482 @ 40), (6, 20), (N/A), NO-IR
(2474 – 2494 @ 20), (6, 20), (N/A), NO-OFDM, NO-IR
(5170 – 5250 @ 80), (6, 20), (N/A), NO-IR
(5735 – 5835 @ 80), (6, 20), (N/A), NO-IR
(57240 – 63720 @ 2160), (N/A, 0), (N/A)

This seemingly indicates the country code has not actually been set. Confusingly, this output remains the same even while connected to a wifi network.


orangepi@orangepii96:~$ ip addr
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: sit0: mtu 1480 qdisc noop state DOWN group default
link/sit 0.0.0.0 brd 0.0.0.0
3: wlan0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether ba:3a:96:d3:49:58 brd ff:ff:ff:ff:ff:ff
inet 192.168.208.254/24 brd 192.168.208.255 scope global dynamic wlan0
valid_lft 3572sec preferred_lft 3572sec
inet6 fe80::b83a:96ff:fed3:4958/64 scope link
valid_lft forever preferred_lft forever

orangepi@orangepii96:~$ sudo iw reg get
global
country 00: DFS-UNSET
(2402 – 2472 @ 40), (6, 20), (N/A)
(2457 – 2482 @ 40), (6, 20), (N/A), NO-IR
(2474 – 2494 @ 20), (6, 20), (N/A), NO-OFDM, NO-IR
(5170 – 5250 @ 80), (6, 20), (N/A), NO-IR
(5735 – 5835 @ 80), (6, 20), (N/A), NO-IR
(57240 – 63720 @ 2160), (N/A, 0), (N/A)

orangepi@orangepii96:~$ sudo iw phy phy0 reg get
global
country 00: DFS-UNSET
(2402 – 2472 @ 40), (6, 20), (N/A)
(2457 – 2482 @ 40), (6, 20), (N/A), NO-IR
(2474 – 2494 @ 20), (6, 20), (N/A), NO-OFDM, NO-IR
(5170 – 5250 @ 80), (6, 20), (N/A), NO-IR
(5735 – 5835 @ 80), (6, 20), (N/A), NO-IR
(57240 – 63720 @ 2160), (N/A, 0), (N/A)

Attempting to set the domain by manually invoking crda also fails (two ways attempted)


orangepi@orangepii96:~$ sudo COUNTRY=US /usr/lib/crda/crda
Failed to set regulatory domain: -7

orangepi@orangepii96:~$ sudo /lib/crda/setregdomain

orangepi@orangepii96:~$ sudo iw reg get
global
country 00: DFS-UNSET
(2402 – 2472 @ 40), (6, 20), (N/A)
(2457 – 2482 @ 40), (6, 20), (N/A), NO-IR
(2474 – 2494 @ 20), (6, 20), (N/A), NO-OFDM, NO-IR
(5170 – 5250 @ 80), (6, 20), (N/A), NO-IR
(5735 – 5835 @ 80), (6, 20), (N/A), NO-IR
(57240 – 63720 @ 2160), (N/A, 0), (N/A)

orangepi@orangepii96:~$ sudo iw phy phy0 reg get
global
country 00: DFS-UNSET
(2402 – 2472 @ 40), (6, 20), (N/A)
(2457 – 2482 @ 40), (6, 20), (N/A), NO-IR
(2474 – 2494 @ 20), (6, 20), (N/A), NO-OFDM, NO-IR
(5170 – 5250 @ 80), (6, 20), (N/A), NO-IR
(5735 – 5835 @ 80), (6, 20), (N/A), NO-IR
(57240 – 63720 @ 2160), (N/A, 0), (N/A)

`

It seems that crda is not working (at least not fully) which could explain the issues with hostapd.

MB3hel
MB3hel
2 years ago

Hey,

Apparently it was common for older wifi drivers to hard code a regulatory domain (not sure why), so I’m not surprised to see this.

I got a chance to quickly test some things on the new image (1.24). I haven’t messed with hostapd yet (and I doubt it will work based on the following), but this is certainly good progress!

In my testing I get results very similar to what you have in dmesg, however I am not seeing the RDAWLAN_ERR lines (perhaps because I set a REGDOMAIN using crda?).

I did also notice a couple of things in the driver

– It looks like the cfg80211_reg_notifier function actually does nothing with the regulatory domain info currently. There’s a disabled block (#if 0) around line 5314 of wland_cfg80211.c that seemingly disables the code that actually sets the regulatory domain. Perhaps it is worth enabling this to see what happens.

– There are various traces prints that could be very helpful for following where in the driver things are happening. It may be beneficial to enable these by changing the log level in wland_dbg.c by changing the wland_dbg_level variable and defining DEBUG.

I don’t have a system setup to build an image on yet, but I’ll probably try the above two things when I do (unless you get to it first).

MB3hel
MB3hel
2 years ago

Hmm…

I didn’t look very closely at that code. It’s located in the section for kernels older than 3.10…

It looks like this driver was a copy of an older kernel driver (I think it may have originally been a driver for Android’s network stack) that someone “updated” to barely work on Linux 3.10 with some features (such as setting country) missing.

To get things working properly, it’s likely necessary to figure out what those functions used to do.

It appears that these likely came from wldev_common.h / wldev_common.c, two random files that seem to be in most android 3.x kernels for wlan drivers. For instance this one and this one. I’d imagine (if this was an old android driver) these files were originally part of this driver too.

I haven’t really looked through them, so not sure what they are / do, but wldev_iovar_setbuf is defined in these files so maybe we can figure out what they actually do. Just from the header comment it seems to be setting an “iovar” (not sure what this is / means). Perhaps looking at modern wireless drivers in the mainline kernel could shed some light on how iovars are handled in modern (and not android) kernels?

Michael
Michael
2 years ago

Hi James,
SPI is working now thanks to you and MZA.
For my e-paper display from waveshare i needed the Opi.GPIO library, but the pin definitions were missing.
I added them here.
I also made a pull request to the original project.
Here is the modified waveshare project which is working for me

1 3 4 5 6 7 9