2025年2月21日 星期五

LCD debug

9341 正常的訊息 

-----------
[    1.664021] ili9341@0 enforce active low on GPIO handle
[    6.580043] fb_ili9341: module is from the staging directory, the quality is 
unknown, you have been warned.
[    6.580648] fb_ili9341 spi0.0: fbtft_property_value: width = 240
[    6.580674] fb_ili9341 spi0.0: fbtft_property_value: height = 320
[    6.580685] fb_ili9341 spi0.0: fbtft_property_value: buswidth = 8
[    6.580697] fb_ili9341 spi0.0: fbtft_property_value: debug = 4
[    6.580706] fb_ili9341 spi0.0: fbtft_property_value: rotate = 90
[    6.580716] fb_ili9341 spi0.0: fbtft_property_value: fps = 30
[    6.580973] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'reset' GPIO
[    6.581032] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'dc' GPIO
[    6.581067] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'rd' GPIO
 ........... 一直重複 -----------
[    6.581590] fb_ili9341 spi0.0: fbtft_request_one_gpio: 'db' GPIO
...
[    6.887247] fb_ili9341 spi0.0: Display update: 3837 kB/s, fps=0
[    6.888155] Console: switching to colour frame buffer device 40x30
[    6.888772] graphics fb0: fb_ili9341 frame buffer, 320x240, 150 KiB video memory, 16 KiB buffer memory, fps=31, spi0.0 at 40 MHz
[    6.999727] systemd[1]: Starting systemd-backlight@backlight:fb_ili9341.service - Load/Save Screen Backlight Brightness of backlight:fb_ili9341...
[    7.003913] systemd[1]: Finished systemd-binfmt.service - Set Up Additional Binary Formats.
[    7.023356] usb 2-1: Firmware revision 11.1 (signature 0x88e1)
[    7.080231] systemd[1]: Finished systemd-backlight@backlight:fb_ili9341.service - Load/Save Screen Backlight Brightness of backlight:fb_ili9341.

--------------

使用 lsmod 

-------------
Module                  Size  Used by
fb_ili9341             12288  1
fbtft                  36864  1 fb_ili9341
-------------


https://mjmwired.net/kernel/Documentation/devicetree/bindings/display/ilitek,ili9486.yaml

參考 Using GPIO from a Linux Shell

--------------
$ dmesg | grep -i ads
[    7.067079] ads7846 spi0.1: supply vcc not found, using dummy regulator
[    7.072789] ads7846 spi0.1: touchscreen, irq 47
[    7.073534] input: ADS7846 Touchscreen as /devices/platform/soc/1c68000.spi/spi_master/spi0/spi0.1/input/input1

$ cat /proc/interrupts | grep ads
 47:         22          0          0          0  sunxi_pio_edge   6 Edge      ads7846

$ sudo gpiodetect
gpiochip0 [1c20800.pinctrl] (224 lines)
gpiochip1 [1f02c00.pinctrl] (32 lines)

$ sudo gpioinfo
gpiochip0 - 224 lines:
line   0:      unnamed       unused   input  active-high 
.....
line   5:      unnamed       unused   input  active-high 
line   6:      unnamed    "pendown"   input   active-low [used]
line   7:      unnamed        "led"  output  active-high [used]
line   8:      unnamed         "dc"  output  active-high [used]
line   9:      unnamed      "reset"  output   active-low [used]
line  10:      unnamed   "spi0 CS0"  output   active-low [used]
line  11:      unnamed       unused   input  active-high 
line  12:      unnamed       unused   input  active-high 
line  13:      unnamed       unused   input  active-high 
line  14:      unnamed       unused   input  active-high 
line  15:      unnamed "orangepi:red:status" output active-high [used]
line  16:      unnamed       unused   input  active-high 
.....
line  20:      unnamed   "spi0 CS1"  output  active-high [used]
.....
line 165:      unnamed       unused   input  active-high 
line 166:      unnamed         "cd"   input   active-low [used]
        ..... 
line 204:      unnamed "usb0_id_det" input active-high [used]
line 205:      unnamed       unused   input  active-high 

--------------

https://www.kernel.org/doc/Documentation/devicetree/bindings/input/touchscreen/ads7846.txt

https://github.com/raspberrypi/linux/pull/6029 (Mar 13, 2024)

The driver has been converted to use gpiod, which will normalise polarity based on DT.

The piscreen overlay (and others) incorrectly defines the pendown GPIO as being ACTIVE_HIGH (0), althought triggering on the high-low edge for pen down. It therefore tries reading the pen position when not being touched, and stops when it is touched.

Tested with piscreen and ads7846 overlays. Also fixed on others where the interrupt says high->low but the polarity was ACTIVE_HIGH.


ADS7846 Touch controller does not work anymore after upgrade to the latest kernel 6.6.20 on 64-bit Raspberry Pi OS Bookworm. It works well with the older kernel 6.1.0.

https://github.com/raspberrypi/linux/blob/rpi-6.6.y/arch/arm/boot/dts/overlays/ads7846-overlay.dts

-----------
pendown-gpio = <&pio 0 19 0>;
line  19:      unnamed    "pendown"   input  active-high [used]

pendown-gpio = <&pio 0 19 1>;
line  19:      unnamed    "pendown"   input   active-low [used]
---------------






2025年2月16日 星期日

在 Klipper 中使用 Fly 3D 的 D5

以前買來就直接使用。最近,怎麼都連不上。比較裝置的代碼,才發現不同

 /dev/serial/by-id/usb-katapult_stm32f072xb_MELLOW-if00

燒了 Klipper 的 firmware,應是

/dev/serial/by-id/usb-Klipper_stm32f072xb_3C0029000557465036383420-if00

原來,在2024年9月1号之后出厂的D5已经刷好Katapult固件。 

照著它的文件,就可以重新設定和 build 映像檔了。

https://mellow.klipper.cn/docs/ProductDoc/MainBoard/fly-d/fly-d5/flash/usb

燒入的指令

~/katapult/scripts$ python3 flashtool.py -d  /dev/serial/by-id/usb-katapult_stm32f072xb_MELLOW-if00

喇叭要關掉,要設 default 值。


2024年12月13日 星期五

Orange Pi One 安裝使用

網拍上,有人便宜拍賣汰換的 Orange Pi One 單板電腦,相對便宜很多,就買了幾個回來備用。

電源插頭的規格 (Plug tip size),4.0mm x 1.7mm。


到 Armbian - Orange Pi One 下載 image,是最新的 kernel。下載的是 xz 的壓縮檔,使用 unxz 解壓縮,unxz -k file.xz 則能保存壓縮檔。

可以使用圖形界面的燒錄程式,會檢查燒錄結果。也可以用 dddcfldd,後者較快,指令如下。

$ sudo dcfldd if=Armbian_xxx_Orangepizero3_bookworm_xxxx_minimal.img of=/dev/sde bs=10M

買的開發板,有附盒子,風扇,USB 轉圓柱頭的電源線,這些自己買,又要一百多吧。電源接頭規格 DC 4.0x1.7mm,打算買 DC-DC 的板子來將 24V 轉成 5V,給香橙派用。

WiFi使用 

------------
dmesg 的訊息
[    6.976374] systemd[1]: Listening on systemd-rfkill.socket - Load/Save RF Kil
l Switch Status /dev/rfkill Watch.
[    7.090397] usb 2-1: RTL8188EU rev D (TSMC) romver 0, 1T1R, TX queues 2, WiFi=1, BT=0, GPS=0, HI PA=0
[    7.090433] usb 2-1: RTL8188EU MAC: e0:e1:a9:93:da:11
[    7.090444] usb 2-1: rtl8xxxu: Loading firmware rtlwifi/rtl8188eufw.bin
[    7.398809] usb 2-1: Firmware revision 11.1 (signature 0x88e1)


$ lsmod 
Module                  Size  Used by
rtl8xxxu              159744  0
binfmt_misc            16384  1
mac80211              643072  1 rtl8xxxu
libarc4                12288  1 mac80211
-------------------

Orange Pi One,終究是 2016 的產品,使用上的體驗,速度遠比不上 2023 年出的  Orange Pi Zero 3。以電腦的進步來看,7年的時間,速度大約至少差 2倍。但是網拍的二手貨,很便宜,買一些來改 3D 印表機。3D 印表機改 Klipper,至少要一個上位機。只改一台,錢差一點沒差,但收集了一堆來改,改完想賣出,差幾百,就不一定有人要收,成本能省就省吧。 在成本上比較,前者,主板+WiFi+SD卡,約 400元,後者,主板+SD卡,約 600元。

安裝 armbian 的 image,版本比較新,https://www.armbian.com/orange-pi-one/ 。

即使安裝 network-manager,"apt install network-manager",執行 nmtui,顯示不正常。只好用 armbian-config 設定 WiFi。

參考 ARMBIAN OS - Networking,Armbian 預設使用 Netplan.io 來描述網路設定。使用 armbian-config 設定後,會將設定存在 /etc/netplan/armbian.yaml,直接修改設定,再執行  "netplan apply",即可讓設定生效。 

# cat armbian.yaml
network:
  version: 2
  renderer: networkd
  wifis:
    wlx40a5ef154b5f:
#      dhcp4: true
#      dhcp6: true
      addresses:
        - 10.161.86.137/20
      routes:
        - to: default
          via: 10.161.80.1
      nameservers:
        addresses:
          -  8.8.8.8
          - 8.8.8.4
      access-points:
        "Samsung-A50-cc":
          auth:
            key-management: "psk"
            password: "wifi-password"

"renderer: networkd",是指使用 systemd-networkd 的網路設定。但 Klipper 會安裝 NetworkManager。改用 NetworkManager,參考 Migrate Ubuntu server from NetPlan to NetworkManager without disconnection (possibly over SSH) 。

安裝 NetworkManager:

$ sudo apt install network-manager 

設定好 NetworkManager 後,Disable networkd and purge netplan:

$ sudo systemctl disable --now systemd-networkd.service systemd-networkd.socket networkd-dispatcher.service 
$ sudo systemctl restart NetworkManager
$ sudo apt purge netplan netplan.io -y

若沒有停掉 netplan 和 systemd-networkd,開機會要等 3分鐘才完成。

上面的作法,後來好像沒用,改用下面作法。

$ sudo systemctl disable --now systemd-networkd.service systemd-networkd.socket systemd-networkd-wait-online.service 
$ sudo systemctl restart NetworkManager
$ sudo systemctl mask systemd-networkd-wait-online.service

修改 /etc/netplan/armbian.yaml,如下。

network:
  version: 2
  renderer: NetworkManager

可以使用 systemd-analyze 產生時間圖,看看開機卡在那裡

$ systemd-analyze plot > systemd-analyze.svg 

由圖檔知道,一開始,kenerl 載入花了 5秒,systemd 程式載入用了 2秒,之後才開始啟動各種服務。

由時間圖,可以看到 systemd-networkd-wait-online.service 的時間是 2min 267ms,所以整個開機等了 3分鐘才完成。systemd-networkd-wait-online 會等有線網路啟動,一直到超過時間才跳過。

ZSWAP 設定

參考 Armbian Documentation - Fine Tuning: Swap for experts,簡要說明如下。

By default Armbian implements ZRAM (writing nothing to ‘disk’ but compressing memory pages in RAM) but in case you often run into out of memory errors and your device has some capable storage (e.g. a securely attached NVMe or SATA SSD) you might want to use ZSWAP instead.

不太懂有什麼好,但設一下吧。修改之前,系統顯示訊息如下。

$ systemctl --type swap
  UNIT           LOAD   ACTIVE SUB    DESCRIPTION
  dev-zram0.swap loaded active active /dev/zram0

$ dmesg | grep zswap
[    1.308166] zswap: loaded using pool zstd/zbud

利用 SD 上剩下的一點空間,建立和掛載 swap。修改 /etc/fstab,加上 swap 的掛載指令。

UUID=f6a5fd0a-8ce8-4e75-89b4-e230bd489a76 / ext4 defaults,noatime,commit=120,errors=remount-ro 0 1
UUID=3ce68f02-d664-4ae5-96ad-337c67fd74e4   none   swap   sw    0 0
tmpfs /tmp tmpfs defaults,nosuid 0 0

然後修改 /etc/default/armbian-zram-config,將 SWAP=false 的註解取消,然後重啟系統即可。

修改後,系統顯示訊息如下。

$ systemctl -t swap
  UNIT                                                                      LOAD   ACTIVE SUB    DESCRIPTION                                           
  dev-disk-by\x2duuid-5f0613fb\x2d295b\x2d4587\x2d80ef\x2d54f0c1302a73.swap loaded active active /dev/disk/by-uuid/5f0613fb-295b-4587-80ef-54f0c1302a73

若 SD卡容量比較大,可以使用 gparted 調整分割區的大小,空出比較大的空間建立 swap 分割區。

安裝 Klipper

依照 https://github.com/dw-0/kiauh 安裝 klipper。整個安裝過程,明顯比用 Orange Pi Zero 3 慢很多,可能要 2倍以上的時間。另外,由於記憶體較小,導致 tmpfs 的 /tmp 不足,在安裝 Moonraker 的階段,會耗盡 /tmp 的空間。因此需另建一個暫時的 tmp,步驟如下。

# Create a temp folder on a disk that has a lot of space:
sudo mkdir -p /bigtmp

# Set generous access to the temp folder:
sudo chmod 777 /bigtmp

# Change TMPDIR env to the big folder you just created:
export TMPDIR=/bigtmp

# install package

在安裝 Moonraker 時,改成用此暫時的 tmp。安裝其他的套件,則用 tmpfs,會比較快。安裝 moonraker,最多的時候,使用 /tmp 的空間約 266M。

-------
$ sudo apt install network-manager
....

Setting up network-manager (1.42.4-1) ...
Created symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service 
→ /lib/systemd/system/NetworkManager-dispatcher.service.
Created symlink /etc/systemd/system/network-online.target.wants/NetworkManager-
wait-online.service → /lib/systemd/system/NetworkManager-wait-online.service.
Created symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.serv
ice → /lib/systemd/system/NetworkManager.service.
Processing triggers for dbus (1.14.10-1~deb12u1) ...
-------


安裝谐振测量所需的軟體

參考 Klipper documentation: Measuring Resonances

在執行到下列安裝指令時,很可能會掛掉,ssh 沒反應。

# 先將 TMPDIR env 變數改到實體目錄
$ sudo apt install python3-numpy python3-matplotlib libatlas-base-dev libopenblas-dev
$ export TMPDIR=/bigtmp
$ ~/klippy-env/bin/pip install -v "numpy<1.26"

儘可能把 service 停掉,擠出記憶體。

## 列出所有 active 的 service
systemctl list-units --type=service --state=active
OR
systemctl --type=service --state=active

## 把目前確定沒用的 service 都停掉
sudo systemctl stop klipper
sudo systemctl stop KlipperScreen.service
sudo systemctl stop NetworkManager.service
sudo systemctl stop moonraker.service
sudo systemctl stop nginx.service

終於安裝成功。測試如下,沒有出現錯誤訊息,即是成功。

$ ~/klippy-env/bin/python -c 'import numpy;'
$


啟用 SPI 

使用 armbian-config 啟用 sun8i-h3-spi-spidev,會在 /boot/armbianEnv.txt 中,加入一行

overlays=sun8i-h3-spi-spidev 

從 console 看到載入失敗的訊息

Failed to load '/boot/dtb/overlay/sun8i-h3-sun8i-h3-spi-spidev.dtbo'

因為已加上 overlay_prefix=sun8i-h3。修改後,並加上 param 參數,成功看到 /dev/spidev0.0 的裝置。完整的 /boot/armbianEnv.txt 如下。

verbosity=1
bootlogo=false
console=both
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
rootdev=UUID=5fda7286-2a9d-4d7c-aa26-de3614b88ae6
rootfstype=ext4
overlays=spi-spidev
param_spidev_spi_bus=0
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

可以參考 /boot/dtb/overlay/README.sun8i-h3-overlays 的說明。

Gemini AI 提供的 klipper 的設定

# -----------------------------------------------------
# 1. 設置 Orange Pi One 本身為一個 MCU
# -----------------------------------------------------
[mcu rpi]
# 使用 host mcu 驅動 ADXL345
serial: /tmp/klipper_host_mcu 
# 確保您已經在 Klipper 安裝時編譯並啟動了 host mcu


# -----------------------------------------------------
# 2. 設置 ADXL345 加速度計
# -----------------------------------------------------
[adxl345]
# 這裡的 cs_pin 必須指向您在 OPi One 上連接 ADXL345 CS (片選) 的 GPIO 引腳
# 由於 Orange Pi 的引腳名稱不是標準的 Raspberry Pi 格式,您需要將 'rpi:' 替換為實際的 GPIO 名稱
# 
# **最常見的配置是讓 Klipper 使用 Host MCU 進行 SPI 溝通**
# 如果您已在 Armbian 啟用 SPI,Klipper 預設會使用 `/dev/spidevX.Y` 介面,
# 您可以將 cs_pin 設為 None,讓 Klipper 使用 SPI 驅動。
cs_pin: rpi:None 
spi_bus: spidev0.0 # 如果需要指定 SPI 總線,請參考 Klipper 文件

# -----------------------------------------------------
# 3. 設置共振測試器
# -----------------------------------------------------
[resonance_tester]
accel_chip: adxl345
probe_points: 90, 125, 20 # 設置測試點 (例如床面中心)

可用 ACCELEROMETER_QUERY 这个命令是查询加速器的参数。

接線

IO 的接腳如下。


觸控屏

--------------
OPi One wiring:
Pin 1  - 3.3V  (or Pin 4 - 5V)
Pin 6  - GND
Pin 35 - PA10 <-->  LCD CS   
Pin 33 - PA9  <-->  RESET
Pin 31 - PA8  <-->  DC
Pin 19 - PC0  <-->  SPI0 SDI<MOSI> & T_DIN
Pin 23 - PC2  <-->  SPI0 SCK       & T_CLK
Pin 29 - PA7  <-->  LED
Pin 21 - PC1  <-->  SPI0 SDO<MISO> & T_DO 
Pin 26 - PA20 <-->  T_CS
Pin 28 - PA19 <-->  T_IRQ
--------------
* LCD 的 MISO 不用接,接了可能使得觸控失效。

建立 /boot/overlay-user/ili9341_lcd.dts,內容如下。

/dts-v1/;
/plugin/;

/ {
    compatible = "xunlong,orangepi-one", "allwinner,sun8i-h3";

    fragment@0 {
        target = <&spi0>;
        __overlay__ {
            status = "okay";
            // cs-gpios = <&pio 0 10 0>; /* PA10*/
            cs-gpios = <&pio 0 10 0>, <&pio 0 20 0>; /* PA10 PA20 */

            ili9341: ili9341@0 {
                compatible = "ilitek,ili9341";
                reg = <0>;  /* Chip Select 0 */
		#spi-cs-high;
                spi-max-frequency = <40000000>;
                rotate = <90>;
                bgr = <0>;
                fps = <30>;
		width = <240>;
		height = <320>;
                buswidth = <8>;
                reset-gpios = <&pio 0 9 1>; /*RESET=PA9*/
                dc-gpios = <&pio 0 8 0>; /*DC_RS=PA8*/
                led-gpios = <&pio 0 7 0>; /*LED=PA7*/
                debug = <4>;
            };

	    ads7846: ads7846@0 {
                compatible = "ti,ads7846";
                reg = <1>;  /* Chip Select 1 */
		#spi-cs-high;
                spi-max-frequency = <1000000>;
                interrupt-parent = <&pio>;
                /* IRQ PA19 */
                interrupts = <0 19 2>; /* IRQ_TYPE_EDGE_FALLING */
                pendown-gpio = <&pio 0 19 1>; /* ACTIVE_HIGH */
		/* ti,swap-xy = <0x1>; */
		ti,x-min = /bits/ 16 <0>;
                ti,y-min = /bits/ 16 <0>;
                ti,x-max = /bits/ 16 <0x0FFF>;
                ti,y-max = /bits/ 16 <0x0FFF>;
                ti,pressure-min = /bits/ 16 <0>;
                ti,pressure-max = /bits/ 16 <0xFFFF>;
		ti,x-plate-ohms = /bits/ 16 <400>;
            };

        };
    };
};

再執行下面的指令,

------------------
armbian-add-overlay ili9341_lcd.dts
------------------



方便 PCB 佈線,接腳更改如下
--------------
OPi One wiring:
Pin 1  - 3.3V  (or Pin 4 - 5V)
Pin 6  - GND
Pin 7  - PA6  <-->  LCD CS   
Pin 8  - PA13 <-->  RESET
Pin 10 - PA14 <-->  DC
Pin 19 - PC0  <-->  SPI0 SDI<MOSI> & T_DIN
Pin 23 - PC2  <-->  SPI0 SCK       & T_CLK
Pin 3  - PA12 <-->  LED
Pin 21 - PC1  <-->  SPI0 SDO<MISO> & T_DO 
Pin 26 - PA21 <-->  T_CS
Pin 28 - PA18 <-->  T_IRQ
--------------





2024年11月26日 星期二

Docker 吃掉硬碟空間處理

docker container 的 log 會無限成長,可以有好幾個 GB,只能手動刪除。

-------------------
# du -h -d 1
7.6G ./usr
47G ./var

# du /var/ -h -d 1
6.9G /var/cache
509M /var/log
40G /var/lib

# du /var/cache/ -h -d 1
942M /var/cache/debtap
5.6G /var/cache/pacman
387M /var/cache/pkgfile
6.9G /var/cache/

# pacman -Sc
Packages to keep:
  All locally installed packages

Cache directory: /var/cache/pacman/pkg/
:: Do you want to remove all other packages from cache? [Y/n] 
removing old packages from cache...
error: missing package metadata in /var/cache/pacman/pkg/unzip-6.0-20-x86_64.pkg.tar.zst.part

Database directory: /var/lib/pacman/
:: Do you want to remove unused repositories? [Y/n] 
removing unused sync repositories...

# du /var/cache/ -h -d 1
3.2M /var/cache/samba
80K /var/cache/ldconfig
942M /var/cache/debtap
2.1G /var/cache/pacman
387M /var/cache/pkgfile
4.0K /var/cache/private
1.1M /var/cache/fontconfig
3.4G /var/cache/


# du -h -d 1
4.1M ./f61f4a601db2be573c2b6351a04fcf1e79540e3cd8e1de41c6c9ab4a0fa204e0
48K ./2136c92af607bfee2ca204d3c77843dce66d7706f753e944dbe84820cf72c5ee
40K ./dc1f8e5f1fb6be942dad52e52453e2960d3bedf788f1774ddfe4462a03c66dc3
21G ./f3c5128d570fec0021b34ff8650fe9dcc531a2bcc59feb52aa9ff1e3f87b7e39
10M ./a3aefcd51740895bb721982b2dff7bfbcea164290b626a1dfb226b3a85274e50

dc1f8e5f1fb6 ==> nginx-hls-vod-server-web


清除所有 container 的 log
# truncate -s 0 /var/lib/docker/containers/*/*-json.log
-------------------

可以設 option,限制log 的大小。

--------------------------
file: /etc/docker/daemon.json
{
  "log-opts": {
    "max-size": "20m",
    "max-file": "5"
  }
}
--------------------------



2024年11月23日 星期六

MKS 安裝非官方 image -- redrathnure / armbian-mkspi


安裝 MKS PI 官方的 image,問題實在多,例如,重新啟動後,USB 無線網卡不會動,無法自己編譯 USB網卡的驅動。

redrathnure / armbian-mkspi,提供依據 Armbian 的 build image 程序所建立專案。

可以自己建,也可以直接下載已建立的 image 來用。

若有裝 MKS LCD,啟動後,可以在 LCD 上看到系統啟動過程。

安裝 rtl8188gu 驅動

安裝的是 McMCCRU / rtl8188gu 的驅動。

make 時,要加上參數,"make ARCH=arm64"。

另外,os_dep/linux/ioctl_cfg80211.c 中,呼叫 cfg80211_ch_switch_notify() 時,少一個參數,修改後,即可成功編譯。

---------------------
cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0, 0);
---------------------

但是在載入 module 時,會出現無法載入 firmware 的錯誤。

---------------
[ 4377.664977] usb 1-1: RTL8710BU rev A (SMIC) romver 1, 1T1R, TX queues 3, WiFi
=1, BT=0, GPS=0, HI PA=0
[ 4377.665002] usb 1-1: RTL8710BU MAC: 50:2b:73:64:0e:e6
[ 4377.665011] usb 1-1: rtl8xxxu: Loading firmware rtlwifi/rtl8710bufw_SMIC.bin
[ 4377.665131] usb 1-1: Direct firmware load for rtlwifi/rtl8710bufw_SMIC.bin failed with error -2
[ 4377.665146] usb 1-1: request_firmware(rtlwifi/rtl8710bufw_SMIC.bin) failed
[ 4377.665155] usb 1-1: Fatal - failed to load firmware
[ 4377.665187] rtl8xxxu: probe of 1-1:1.0 failed with error -11
[ 4377.681468] 8188gu: loading out-of-tree module taints kernel.
[ 4377.711868] usbcore: registered new interface driver rtl8710bu
----------------

預設是安裝 armbian-firmware,/lib/firmware 下,沒有 rtlwifi/rtl8710bufw_SMIC.bin。

-----------------------
$ sudo apt install linux-firmware
[sudo] password for mks: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package linux-firmware is a virtual package provided by:
  armbian-firmware-full 24.8.3
  armbian-firmware 24.11.1
You should explicitly select one to install.
-----------------------

若自己下載再 copy 到那個目錄下,會出現 Invalid firmware signature 的錯誤。

-----------------------
[  752.779538] usb 1-1: new high-speed USB device number 4 using dwc2
[  753.256104] usb 1-1: New USB device found, idVendor=0bda, idProduct=b711, bcdDevice= 2.00
[  753.256126] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  753.256134] usb 1-1: Product: 802.11n WLAN Adapter
[  753.256141] usb 1-1: Manufacturer: Realtek
[  753.256147] usb 1-1: SerialNumber: 00E04CB82101
[  753.284791] usb 1-1: RTL8710BU rev A (SMIC) romver 1, 1T1R, TX queues 3, WiFi=1, BT=0, GPS=0, HI PA=0
[  753.284815] usb 1-1: RTL8710BU MAC: 50:2b:73:64:0e:e6
[  753.284824] usb 1-1: rtl8xxxu: Loading firmware rtlwifi/rtl8710bufw_SMIC.bin
[  753.285626] usb 1-1: rtl8xxxu_load_firmware: Invalid firmware signature: 0x213c
[  753.285646] usb 1-1: Firmware revision 21571.89 (signature 0x213c)
[  753.285695] usb 1-1: Fatal - failed to load firmware
[  753.285731] rtl8xxxu: probe of 1-1:1.0 failed with error -22
[  753.327045] rtl8710bu 1-1:1.0 wlx502b73640ee6: renamed from wlan0
[  753.417659] rtl8710bu 1-1:1.0 wlx502b73640ee6: Current addr:  50 2b 73 64 0e e6 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
[  753.417690] rtl8710bu 1-1:1.0 wlx502b73640ee6: Expected addr: 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
[  753.417700] ------------[ cut here ]------------
[  753.417704] netdevice: wlx502b73640ee6: Incorrect netdev->dev_addr
[  753.417774] WARNING: CPU: 1 PID: 633 at net/core/dev_addr_lists.c:519 dev_addr_check+0xb0/0x140
[  753.417801] Modules linked in: uas lz4hc lz4 zram 8188gu(O) nls_iso8859_1 rtl8xxxu mac80211 cfg80211 snd_soc_spdif_tx rfkill snd_soc_simple_card libarc4 snd_soc_simple_card_utils hantro_vpu rockchip_vdec(C) v4l2_vp9 rockchip_rga videobuf2_dma_contig v4l2_h264 videobuf2_dma_sg v4l2_mem2mem videobuf2_memops videobuf2_v4l2 snd_soc_hdmi_codec videodev videobuf2_common mc snd_soc_rockchip_spdif snd_soc_core fb_st7796(C) snd_compress fbtft(C) snd_pcm_dmaengine snd_pcm snd_timer rk_crypto snd soundcore rng_core cpufreq_dt joydev ads7846 sunrpc ip_tables x_tables autofs4 dwmac_rk stmmac_platform stmmac pcs_xpcs lima gpu_sched drm_shmem_helper dw_hdmi_cec dw_hdmi_i2s_audio spidev gpio_syscon

-----------------------

重新裝 armbian-firmware-full 後,就有 rtlwifi/rtl8710bufw_SMIC.bin 這個檔了。重新插拔 USB WIFI 網卡,可以正常載入 firmware。

-----------------------
[ 1729.358248] usb 1-1: new high-speed USB device number 6 using dwc2
[ 1729.834781] usb 1-1: New USB device found, idVendor=0bda, idProduct=b711, bcdDevice= 2.00
[ 1729.834801] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1729.834809] usb 1-1: Product: 802.11n WLAN Adapter
[ 1729.834816] usb 1-1: Manufacturer: Realtek
[ 1729.834822] usb 1-1: SerialNumber: 00E04CB82101
[ 1729.863786] usb 1-1: RTL8710BU rev A (SMIC) romver 1, 1T1R, TX queues 3, WiFi=1, BT=0, GPS=0, HI PA=0
[ 1729.863811] usb 1-1: RTL8710BU MAC: 50:2b:73:64:0e:e6
[ 1729.863820] usb 1-1: rtl8xxxu: Loading firmware rtlwifi/rtl8710bufw_SMIC.bin
[ 1729.864170] usb 1-1: Firmware revision 16.0 (signature 0x10b1)
[ 1731.131773] rtl8xxxu 1-1:1.0 wlx502b73640ee6: renamed from wlan0
[ 1732.597696] wlx502b73640ee6: authenticate with 2c:4d:54:5f:30:c8
[ 1732.605563] wlx502b73640ee6: send auth to 2c:4d:54:5f:30:c8 (try 1/3)
[ 1732.611218] wlx502b73640ee6: authenticated
[ 1732.611797] wlx502b73640ee6: associating to AP 2c:4d:54:5f:30:c8 with corrupt probe response
[ 1732.614590] wlx502b73640ee6: associate with 2c:4d:54:5f:30:c8 (try 1/3)
[ 1732.620845] wlx502b73640ee6: RX AssocResp from 2c:4d:54:5f:30:c8 (capab=0xc31 status=0 aid=4)
[ 1732.622572] usb 1-1: rtl8xxxu_bss_info_changed: HT supported
[ 1732.625258] wlx502b73640ee6: associated
-----------------------





2024年10月30日 星期三

CNC 使用摘要

 透過網路買了一台二手 CNC,慢慢熟悉中。


使用的控制板,極造科技 VVIP_ESP32_V1.0,網路上找不到資料。

賣家寄出前,把它設成 AP mode,造著他說的,用網路連上後,再把 WIFI 設成 Client mode,可以用其他電腦連上。

確定正常後,開始探索,可以做些什麼事。發現板子上的 Micro USB,應該是 UART 界面。使用 putty 連上後,出現熟悉的 ok,可能是 forth 系統吧。打的字不會出現,換行後不會從頭開始顯示,果然和 forth 的特性一樣。修改 putty 的 terminal 的設定,勾選 "Implicit CR in every LF","Local echo" 設成 "Force on",操作就正常了。

可以使用的指令,參考 Grbl v1.1 Commands 。

WIFI 設定,參考 Can't Get WiFi to Connect #465

-----------------
[ESP420] 指令顯示的訊息
Chip ID: 12311
CPU Frequency: 240Mhz
CPU Temperature: 46.7C
Free memory: 125.65 KB
SDK: v3.2.3-14-gd3e562907
Flash Size: 4.00 MB
Available Size for update: 1.87 MB
Available Size for SPIFFS: 169.38 KB
Baud rate: 115200
Sleep mode: Modem
Web port: 80
Data port: 23
Hostname: cnc
Current WiFi Mode: STA (4C:11:AE:D7:17:30)
Connected to: TOTOLINK_N200RE
Signal: 100%
Phy Mode: 11n
Channel: 10
IP Mode: DHCP
IP: 192.168.66.217
Gateway: 192.168.66.1
Mask: 255.255.255.0
DNS: 192.168.66.1
Disabled Mode: AP (4C:11:AE:D7:17:31)
Current BT Mode: Off
Notifications: Disabled
FW version: 1.1f (20200319) (ESP32)
-----------------

安裝 FluidNC

安裝說明 FluidNC Web Installer。安裝很容易,照著說明做,完全不用自己編譯檔案。下載對應的 zip 檔,例如使用 Linux,下載 fluidnc-v3.8.3-posix.zip,解壓縮後,到解壓的目錄下,先把 USB 連上電腦,再執行 "sudo install-wifi.sh"。因為要有 root 的權限,才能開啟 /dev/ttyUSB0,所以用 sudo 執行。一路自動安裝完,然後自動進入 xmodem。

設定說明 1. Config file Overview


2024年10月13日 星期日

透過 tiny-drm 驅動 spi 觸控螢幕

參考連結 

  • Milk-V Duo tinydrm驱动屏幕(ili9488/st7789)
  • birdtechstep / tinydrm
  • https://blog.csdn.net/CNflysky/article/details/120492583
  • http://www.orangepi.org/orangepiwiki/index.php/Orange_Pi_Zero_3
  • https://lore.kernel.org/lkml/760f8dc6-3bd9-d63a-37e1-c9e472c09285@tronnes.org/T/
  • https://github.com/under-view/spi-tft-ILI9488,Development is done with kernel version 6.1.9
--------------
$ lsmod
Module                  Size  Used by
ili9341                16384  0
drm_mipi_dbi           28672  1 ili9341
--------------

網誌存檔