2022年9月30日 星期五

使用電腦執行 Klipper 控制 MKS Gen_L V2.1

想使用 docker 來測試 klipper,參考 https://github.com/mkuf/prind


那個 type-B 的 USB 接頭實在很煩,線又很短,有空來換成 type-c 的接頭吧。連上後,使用 dmesg 顯示訊息如下。

------------------------------------
[   55.491549] usb 2-1.1: new full-speed USB device number 4 using ehci-pci
[   55.601246] usb 2-1.1: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice=81.34
[   55.601265] usb 2-1.1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[   55.601272] usb 2-1.1: Product: USB Serial
[   55.601901] ch341 2-1.1:1.0: ch341-uart converter detected
[   55.606120] usb 2-1.1: ch341-uart converter now attached to ttyUSB0
-----------------------------------

使用 Gentoo,必須設定和編譯 Kernel,新增 module「USB Winchiphead CH341 Single Port Serial Driver (USB_SERIAL_CH341)」。

--------------------
mks@mkspi:~/klipper$ make flash FLASH_DEVICE=/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
  Flashing out/klipper.elf.hex to /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0 via avrdude

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "out/klipper.elf.hex"
avrdude: writing flash (30148 bytes):

Writing | ################################################## | 100% 4.83s

avrdude: 30148 bytes of flash written
avrdude: verifying flash memory against out/klipper.elf.hex:
avrdude: load data flash data from input file out/klipper.elf.hex:
avrdude: input file out/klipper.elf.hex contains 30148 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 3.68s

avrdude: verifying ...
avrdude: 30148 bytes of flash verified

avrdude: safemode: Fuses OK (E:FD, H:D8, L:FF)

avrdude done.  Thank you.

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

從 MKS 的文件找到的 PIN 腳圖,把用到的 PIN 腳改成 Klipper 使用的標號。




2022年9月26日 星期一

占美 1037u 迷你電腦安裝 Ubuntu Linux

占美 1037u 迷你電腦,2013 年的產品,蠻舊的。在露天拍賣買的,$1,579,免運費。拿到機器就直接插電測試,卻看不到指示燈。拆開機殼查看,發現有2個藍色指示燈,卻沒有對準開孔,不曉得這樣裝是要幹嘛。後來再檢查接線,兩個LED是並聯的,就更讓人納悶這是在幹嘛。

主機板的型號 GHM7X VER. A,可惜找不到板子的相關資訊,這就是玩大陸生產的東西不好的地方,台灣生產的也差不多,都不願意公開技術資訊。

CPU 和晶片組焊在板子的背面,使用機殼散熱。



買它的目的是想用它來裝 Klipper,控制 3D印表機。蠻奇怪的,插上 USB 隨身碟就抓不到鍵盤,也無法從隨身碟開機。後來把 Thinkpad 已經裝好 Ubuntu 的SSD拔過來裝上,就可以開機了。

上面原來有一個 24GB 的 msata SDD,原來是裝 Win7。Ubuntu 裝好後,大約佔用 10GB 的空間,就用 cpio 把它 clone 到這個 msata SDD 上,再把控制3D印表機不需要用的軟體砍一砍。

整個安裝複製的過程大致整理如下。

先確認 Ubuntu 的 partition 和 file type。主分割區是 ext4,開機分割區是 vfat32。

root@ajax-ThinkPad-X220:~# df -Th

Filesystem Type   Size  Used Avail Use% Mounted on

tmpfs      tmpfs  382M  1.7M  381M   1% /run

/dev/sdb3  ext4   219G  9.2G  199G   5% /

tmpfs      tmpfs  1.9G 0  1.9G   0% /dev/shm

tmpfs      tmpfs  5.0M  4.0K  5.0M   1% /run/lock

/dev/sdb2  vfat   512M  5.3M  507M   2% /boot/efi

tmpfs      tmpfs  382M  112K  382M   1% /run/user/1000

msata ssd 原來的分割區。

                            Disk: /dev/sda

           Size: 22.37 GiB, 24015495168 bytes, 46905264 sectors

                    Label: dos, identifier: 0x89b50dd4


Device   Boot  Start   End   Sectors  Size  Id Type

>>  /dev/sda1   *     2048 206847 204800   100M   7 HPFS/NTFS/exFAT

/dev/sda2        206848  46901247  46694400 22.3G  7 HPFS/NTFS/exFAT

Free space      46901248  46905263  4016 2M



Ubuntu 的分割區,使用 gpt 分割表。

                            Disk: /dev/sdb

         Size: 223.57 GiB, 240057409536 bytes, 468862128 sectors

       Label: gpt, identifier: 7F3A45A7-012A-4334-A4D6-56D8572C44BE


Device         Start     End Sectors Size Type

>>  /dev/sdb1       2048    4095    2048   1M BIOS boot     

/dev/sdb2       4096 1054719 1050624 513M EFI System

/dev/sdb3    1054720   468860927   467806208   223.1G Linux filesystem


格式化磁區,然後再用 cpio 複製磁區。

root@ajax-ThinkPad-X220:/# mkfs.vfat -F 32 /dev/sda2

root@ajax-ThinkPad-X220:/# mkfs.ext4 /dev/sda3


root@ajax-ThinkPad-X220:/# mount /dev/sda2 /mnt

root@ajax-ThinkPad-X220:/# cd /boot/efi

root@ajax-ThinkPad-X220:/# find ./ -xdev -print0 | cpio -pa0V /mnt

root@ajax-ThinkPad-X220:/# umount /mnt


root@ajax-ThinkPad-X220:/# mount /dev/sda3 /mnt

root@ajax-ThinkPad-X220:/# cd /

root@ajax-ThinkPad-X220:/# find ./ -xdev -print0 | cpio -pa0V /mnt


參考下面的連結,使用 chroot 設定開機磁區,How to Repair or Re-install GRUB using the chroot command/

步驟如下

# 掛載磁區

root@ajax-ThinkPad-X220:/# mount /dev/sda3 /mnt

root@ajax-ThinkPad-X220:/# mount /dev/sda2 /mnt/boot/efi/

root@ajax-ThinkPad-X220:/# mount --bind /dev /mnt/dev

root@ajax-ThinkPad-X220:/# mount --bind /dev/pts /mnt/dev/pts

root@ajax-ThinkPad-X220:/# mount --bind /proc /mnt/proc

root@ajax-ThinkPad-X220:/# mount --bind /sys /mnt/sys

root@ajax-ThinkPad-X220:/#  chroot /mnt

-----------

# 進入 chroot,設定開機

root@ajax-ThinkPad-X220:/# grub-install /dev/sda

Installing for x86_64-efi platform.

grub-install: warning: EFI variables cannot be set on this system.

grub-install: warning: You will have to complete the GRUB setup manually.

Installation finished. No error reported.

root@ajax-ThinkPad-X220:/# grub-install --recheck /dev/sda

Installing for x86_64-efi platform.

grub-install: warning: EFI variables cannot be set on this system.

grub-install: warning: You will have to complete the GRUB setup manually.

Installation finished. No error reported.

root@ajax-ThinkPad-X220:/# update-grub

Sourcing file `/etc/default/grub'

Sourcing file `/etc/default/grub.d/init-select.cfg'

Generating grub configuration file ...

Found linux image: /boot/vmlinuz-5.15.0-48-generic

Found initrd image: /boot/initrd.img-5.15.0-48-generic

Found linux image: /boot/vmlinuz-5.15.0-25-generic

Found initrd image: /boot/initrd.img-5.15.0-25-generic

Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting

Warning: os-prober will not be executed to detect other bootable partitions.

Systems on them will not be added to the GRUB boot configuration.

Check GRUB_DISABLE_OS_PROBER documentation entry.

done






2022年9月1日 星期四

Cyclone-PCB-Factory

 

Cyclone-PCB-Factory- PCB雕刻机[1/18]

Cyclone-PCB-Factory- PCB雕刻机[2/18] ﹣Making a PCB

Cyclone-PCB-Factory- PCB雕刻机[3/18] ﹣Config GRBL

Cyclone-PCB-Factory- PCB雕刻机[4/18] ﹣make the print parts

Cyclone-PCB-Factory- PCB雕刻机[5/18] ﹣home sensor config and test

Cyclone-PCB-Factory- PCB雕刻机[6/18] ﹣How to use bCNC

Cyclone-PCB-Factory- PCB雕刻机[7/18] ﹣Blender CAM﹣a G-code generation tool

Cyclone-PCB-Factory- PCB雕刻机[8/18] ﹣config the X-frame of 3D parts

Cyclone-PCB-Factory- PCB雕刻机[9/18] ﹣ Spindle + ER11 test

Cyclone-PCB-Factory- PCB雕刻机[10/18] - Final assembly

Cyclone-PCB-Factory- PCB雕刻机[11/18] - Spindle + V-cutter/ Probe testing

Cyclone-PCB-Factory- PCB雕刻机[12/18] - Controller box building

Cyclone-PCB-Factory- PCB雕刻机[13/18] - Spindle holder enhancement

Cyclone-PCB-Factory- PCB雕刻机[14/18] - PCB carve testing with Hellokitty

Cyclone-PCB-Factory- PCB雕刻机[15/18] - PCB carve testing with Gundam

Cyclone-PCB-Factory- PCB雕刻机[16/18] - PCB carve testing with Spider-PCB layout

Cyclone-PCB-Factory- PCB雕刻机[17/18] - PCB carve test-II with Spider-PCB layout

Cyclone-PCB-Factory- PCB雕刻机[18/18] - Lesson & Learn心得分享


Cyclone-PCB-Factory- PCB雕刻机 - Controller Box design控制器外殼設計

 Cyclone-PCB-Factory- PCB雕刻机 - PCB holder 平台固定PCB         

Cyclone-PCB-Factory- PCB雕刻机 - CNC big cover防塵罩製作












網誌存檔