OpenWrt master 运行出错
fanck0605 opened this issue · 14 comments
自己用 OpenWrt master 的源码编译的,无法正常启动。
是不是依赖没装全,麻烦大佬看一下。
root@OpenWrt:~# /usr/bin/oled 0 0 1 1 0 60 0 0 0 0 0 0 0 0 0 0 0 1 OPENWRT
I2C: Failed to open device |: No such file or directory
(Main)i2c-2: OOPS! Something Went Wrong
已merge PR
@NateLol
这是似乎是另一个问题😆,那个 pr 只解决了 luci 显示。
看了一下报错,应该是这两行的错误信息。
https://github.com/NateLol/luci-app-oled/blob/master/src/I2C_Library/I2C.c#L271
https://github.com/NateLol/luci-app-oled/blob/master/src/Example_Code/Main.c#L73
ssh上去试试这个
i2cdetect -y 0
看会不会出来3c
没有的话就有可能依赖没安全。
还可以去看是否有这个目录/dev/i2c-0
没有 i2c-0,只找到了个 i2c-1
root@OpenWrt:~# i2cdetect -y 0
Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory
root@OpenWrt:~# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@OpenWrt:~# ls /dev | grep i2c
i2c-1
root@OpenWrt:~#
@NateLol 应该是我的依赖问题,我再看看
因为这个程序中是写死了的,一定要是/dev/i2c-0
jayanta525 的 openwrt 的 kernel config 里一股脑把 i2c 驱动全选了,所以用着没问题。
我用的是 blocktrron 的 openwrt 编译时,需要手动添加 kmod-i2c-xxx
Hi, I have same issue, and am using Raspberry Pi CM4 router board.
OS information:
pi@upstest:~ $ ssh root@192.168.1.1
The authenticity of host '192.168.1.1 (192.168.1.1)' can't be established.
ED25519 key fingerprint is SHA256:NWZsaa/lvdIosladk3AmESFtMX907u7mhEEw1qZQNAY.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.1' (ED25519) to the list of known hosts.
BusyBox v1.34.0 (2021-09-05 21:52:35 UTC) built-in shell (ash)
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
OpenWrt SNAPSHOT, r0-46dec99
-----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
and I have already compile the kernel with selected i2c
driver.
root@OpenWrt:~# dmesg |grep i2c
[ 6.937830] i2c /dev entries driver
root@OpenWrt:~# lsmod |grep i2c
i2c_algo_bit 16384 1 i2c_gpio
i2c_bcm2835 16384 0
i2c_dev 20480 0
i2c_gpio 16384 0
i2c_mux 16384 1 i2c_mux_gpio
i2c_mux_gpio 16384 0
i2c_smbus 16384 0
root@OpenWrt:~# /usr/bin/oled 0 0 1 1 0 60 0 0 0 0 0 0 0 0 0 0 0 1 OPENWRT
I2C: Failed to open device |: No such file or directory
(Main)i2c-2: OOPS! Something Went Wrong
root@OpenWrt:~# i2cdetect -y 0
Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory
root@OpenWrt:~# i2cdetect -y 1
Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory
root@OpenWrt:~# modprobe i2c-dev
root@OpenWrt:~# opkg list | grep i2c
i2c-tools - 4.3-1
kmod-i2c-algo-bit - 5.10.64-1
kmod-i2c-bcm2835 - 5.10.64-1
kmod-i2c-core - 5.10.64-1
kmod-i2c-gpio - 5.10.64-1
kmod-i2c-mux - 5.10.64-1
kmod-i2c-mux-gpio - 5.10.64-1
kmod-i2c-smbus - 5.10.64-1
libi2c - 4.3-1
and what i need to add into the kernel ? Could you please help me out?
For NanoPi R2S the following patch needs to be applied to activate i2c-0.
Raspberry Pi CM4 may also require a similar patch.
I don't know much about this issue either. I'm sorry that I can't be of more help to you.
For NanoPi R2S the following patch needs to be applied to activate i2c-0.
Raspberry Pi CM4 may also require a similar patch.
I don't know much about this issue either. I'm sorry that I can't be of more help to you.
thanks for your reply, and i have tried another way. and it seems works, but it always show "OLED is not working " in LuCI interface in browser.
I have tried to add this dtoverlay=i2c-gpio,i2c_gpio_sda=2,i2c_gpio_scl=3,i2c_gpio_delay_ us=2,bus=1
to /boot/config.txt and reboot my Raspberry Pi CM4.
now, i can detect the oled 0.91 display 's address via i2cdetec -y 1
but it still not working well.
root@OpenWrt:~# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
when i ran /usr/bin/oled 0 0 1 1 0 60 0 0 0 0 0 0 0 0 0 0 0 1 OPENWRT
command to test it still no luck.
This program will only use
i2c-0
, which is written in the source code. If you connect the OLED toi2c-1
, you need to modify the source code.luci-app-oled/src/Example_Code/Main.c
Line 67 in 8607abf
/* Initialize I2C bus and connect to the I2C Device */ - if(init_i2c_dev(I2C_DEV0_PATH, SSD1306_OLED_ADDR) == 0) + if(init_i2c_dev(I2C_DEV1_PATH, SSD1306_OLED_ADDR) == 0) { printf("(Main)i2c-2: Bus Connected to SSD1306\r\n"); }
I2C_DEVx_PATH
is defined hereluci-app-oled/src/I2C_Library/I2C.h
Line 42 in 8607abf
thanks for your tips, I have already change the test command to :
/usr/bin/oled 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 60 0 1 openwrt 1
and it works.
The key parameters is to change the /boot/config.txt
file and add:
dtoverlay=i2c-gpio,i2c_gpio_sda=2,i2c_gpio_scl=3,i2c_gpio_delay_us=2,bus=1
and BTW, need to change the permission of the etc/init.d/oled
from 644
to 755
. and restart /etc/init.d/oled restart
.
and save it, reboot CM4, it will works fine.
Good, thank you both @yoyojacky @fanck0605 for the effort and this great information.
I am linking this in README for other Raspberry Pi CM4 users who might find it helpful.
Good, thank you both @yoyojacky @fanck0605 for the effort and this great information.
I am linking this in README for other Raspberry Pi CM4 users who might find it helpful.
Thanks for your effort so that i can use your repo to build my custom router via Raspberry Pi CM4 module, it was so nice to have an oled 0.91 display on my router, thanks a lot ...
For the Rpi4/CM4 using the bit-banged kmod-i2c-gpio driver I was seeing 1-2% CPU utilisation from the oled process. strace seemed to indicate this was during write to the driver - makes sense.
I installed kmod-i2c-bcm2835 which is the pi hardware driver which also uses the same pins 2,3 and CPU dropped dramatically.
To enable hardware I2C bus driver for the OLED display if using pins 2,3:
opkg install kmod-i2c-bcm2835
From /boot/config.txt replace:
dtoverlay=i2c-gpio,i2c_gpio_sda=2,i2c_gpio_scl=3,i2c_gpio_delay_us=2,bus=1
with:
dtparam=i2c1=on
After reboot /dev/i2c-1 will be the hardware I2C bus not the bit banged GPIO driver. You should see a 1-2% CPU reduction.
I have jdc ax6600 it has led TM1628A how to control it thank you