ubuntu20.04

2021年8月24日 (火)

ThinkPad X1 Carbon(20HQ)にlinuxをインストールする

2022/1/20
バッテリを交換したので、その状態を追加した。

2021/9/9
バッテリー状態を追加した。

2021/8/24
SATA_SSDの速度結果を追加した。

2021/8/23
初版

ThinkPad X1 Carbon(20HQ) linux install

ThinkPad X1 Carbon(20HQ) linux install

概要

ThinkPad X1 Carbon(20HQ)にlinuxをインストールした際のメモである。

準備

1.クリーンインストールするために、あらかじめ、M.2_NVMe_SSDを用意して NVM2用SSDアダプター(USB3.0)に組み込み、別のPCなどで、ext3/ext4にフォーマットしておく。
2.USB-DVDドライブの用意
3.linuxインストール用DVD(日経linuxの付録などでよい)の用意
実際には、ubuntu20.04を使用した。
4.biosのメニューが選べるようにwindows10の高速スタートアップ(高速起動)を無効化する
以下を参考にして高速起動を無効にする。
Windows 10で高速スタートアップ(高速起動)を無効化する方法

M.2_NVMe_SSDの交換

1.内蔵バッテリーの無効化
(1)バッテリー駆動にしてPCの電源をオンにする。ロゴ画面が表示されたら、すぐに F1 を押すと、ThinkPad Setup に入る。
(2)「Config」 ➙ 「Power」を選択する。「Power」サブメニューが表示される。
(3)「Disable built-in battery」を選択し、Enter キーを押す。
(4)「Setup Confirmation」ウィンドウで、「Yes」を選択する。内蔵バッテリーが無効になり、PCの電源が自動的に切れる。

2.マイクロ SIM カードの取り外し
スマフォなどと同様にSIMカードの穴にピンを入れてカードを取り外す。

3.「ベース・カバー・アセンブリー」の取り外し
以下を参照してベースカバーを取り外す。
ベースカバー・アセンブリの取り外し - Thinkpad x1 Carbon
今回の件では無関係だが、バッテリーを交換する際の情報になるのでバッテリーの型番をメモしておいたほうが良い。
ちなみに、本機の場合、「FRU P/N 01AV494」だった。

4.M.2_NVM2_SSDの交換
以下の動画を参考に準備で用意したフォーマット済みM.2_NVM2_SSDに交換する。
取り付け、取り外し動画 - ThinkPad X1 Carbon Gen 5 (20HQ, 20HR, 20K3, 20K4),ThinkPad X1 Carbon Gen 6 (20KG, 20KH)
なお、交換の際、ヒートシンク用サーマルパッドが貼ってあるようなら、それをはがし新しいボードに張り替える。 新品の持ち合わせがあるようなら、それを使うほうが良いと思われる。

5.「ベース・カバー・アセンブリー」の取り付け
以上で作業は終わったのでカバーを取り付ける。

linuxのインストール

1.インストール用DVDを入れたUSB-DVDドライブをPCに接続する。
2.ACアダプターを接続してPCの電源をオンにする。ロゴ画面が表示されたら、すぐに F12 を連打する。しばらくすると、ブートデバイスを選択するメニューが表示されるので、USB-DVDを選択する。するとDVDからインストールプログラムが読み込まれるので、あとは、linuxのインストールを選択する。

linux起動直後の作業

1.ホームディレクトリ内のディレクトリ名を英語表記にするために 以下を実行する:

LANG=C xdg-user-dirs-gtk-update

ウィンドウが開くので、" Don't ask me this again " にチェックを入れて、 [ Update Names ] をクリックする。

2.googleなどでエラーを検索しやすいようにエラーメッセージを英語にするために以下を.bashrcに登録する:

export LC_ALL=en_US.UTF-8

その他のアプリなどのインストールについては以下を参照のこと。
ubuntu20.04をインストールする
arduinoフレームワーク用platformio.ini集

起動時のログ例

$ uname -a Linux XXXX 5.11.0-27-generic #29~20.04.1-Ubuntu SMP Wed Aug 11 15:58:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux $ df -h Filesystem Size Used Avail Use% Mounted on udev 7.6G 0 7.6G 0% /dev tmpfs 1.6G 1.8M 1.6G 1% /run /dev/nvme0n1p5 916G 8.6G 861G 1% / tmpfs 7.6G 0 7.6G 0% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 7.6G 0 7.6G 0% /sys/fs/cgroup /dev/loop1 256M 256M 0 100% /snap/gnome-3-34-1804/36 /dev/loop0 56M 56M 0 100% /snap/core18/1885 /dev/loop2 63M 63M 0 100% /snap/gtk-common-themes/1506 /dev/loop3 50M 50M 0 100% /snap/snap-store/467 /dev/loop4 30M 30M 0 100% /snap/snapd/8542 /dev/nvme0n1p1 511M 4.0K 511M 1% /boot/efi tmpfs 1.6G 24K 1.6G 1% /run/user/1000 $ iwconfig lo no wireless extensions. enp0s31f6 no wireless extensions. wlp4s0 IEEE 802.11 ESSID:"elecom-xxxxxx" Mode:Managed Frequency:5.18 GHz Access Point: 04:AB:18:E1:EF:26 Bit Rate=520 Mb/s Tx-Power=22 dBm Retry short limit:7 RTS thr:off Fragment thr:off Power Management:on Link Quality=33/70 Signal level=-77 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:3 Invalid misc:1 Missed beacon:0 wwan0 no wireless extensions. $ ls -l /dev/nvm* crw------- 1 root root 240, 0 8月 22 14:16 /dev/nvme0 brw-rw---- 1 root disk 259, 0 8月 22 14:22 /dev/nvme0n1 brw-rw---- 1 root disk 259, 1 8月 22 14:22 /dev/nvme0n1p1 brw-rw---- 1 root disk 259, 2 8月 22 14:22 /dev/nvme0n1p2 brw-rw---- 1 root disk 259, 3 8月 22 14:22 /dev/nvme0n1p5 # nvmeはnvmeストレージを意味する

[参考]SSD速度

インストール:

#ツールをインストールする sudo add-apt-repository ppa:jonmagon/kdiskmark sudo apt install kdiskmark

実行:

kdiskmark #画面が表示されたら[All]をクリックすると測定が開始される。 #測定が終わるまで待つ #測定が完了したら[Alt]+[PrtSc]を押す。 #画面の画像が[Pictures]に保存される。 #[File]/[Save]で測定データをテキストで保存できる。

結果:

KDM_Result

比較(SATA_SSD):

KDM_Result2

[参考]S.M.A.R.T.

インストール:

#S.M.A.R.T.情報を取得するために以下をインストールする: sudo apt install smartmontools

実行:

#diskをスキャンする sudo smartctl --scan /dev/nvme0 -d nvme # /dev/nvme0, NVMe device #デバイス情報を表示する sudo smartctl -i /dev/nvme0 smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.11.0-27-generic] (local build) Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Model Number: Samsung SSD 980 1TB Serial Number: S649NJ0R231646W Firmware Version: 1B4QFXO7 PCI Vendor/Subsystem ID: 0x144d IEEE OUI Identifier: 0x002538 Total NVM Capacity: 1,000,204,886,016 [1.00 TB] Unallocated NVM Capacity: 0 Controller ID: 5 Number of Namespaces: 1 Namespace 1 Size/Capacity: 1,000,204,886,016 [1.00 TB] Namespace 1 Utilization: 28,024,627,200 [28.0 GB] Namespace 1 Formatted LBA Size: 512 Namespace 1 IEEE EUI-64: 002538 d21140cea4 Local Time is: Mon Aug 23 15:58:13 2021 JST #S.M.A.R.T.情報を表示する sudo smartctl -a /dev/nvme0 smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.11.0-27-generic] (local build) Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Model Number: Samsung SSD 980 1TB Serial Number: S649NJ0R231646W Firmware Version: 1B4QFXO7 PCI Vendor/Subsystem ID: 0x144d IEEE OUI Identifier: 0x002538 Total NVM Capacity: 1,000,204,886,016 [1.00 TB] Unallocated NVM Capacity: 0 Controller ID: 5 Number of Namespaces: 1 Namespace 1 Size/Capacity: 1,000,204,886,016 [1.00 TB] Namespace 1 Utilization: 28,024,823,808 [28.0 GB] Namespace 1 Formatted LBA Size: 512 Namespace 1 IEEE EUI-64: 002538 d21140cea4 Local Time is: Mon Aug 23 16:01:17 2021 JST Firmware Updates (0x16): 3 Slots, no Reset required Optional Admin Commands (0x0017): Security Format Frmw_DL Self_Test Optional NVM Commands (0x0055): Comp DS_Mngmt Sav/Sel_Feat Timestmp Maximum Data Transfer Size: 512 Pages Warning Comp. Temp. Threshold: 82 Celsius Critical Comp. Temp. Threshold: 85 Celsius Namespace 1 Features (0x10): *Other* Supported Power States St Op Max Active Idle RL RT WL WT Ent_Lat Ex_Lat 0 + 5.24W - - 0 0 0 0 0 0 1 + 4.49W - - 1 1 1 1 0 0 2 + 2.19W - - 2 2 2 2 0 500 3 - 0.0500W - - 3 3 3 3 210 1200 4 - 0.0050W - - 4 4 4 4 1000 9000 Supported LBA Sizes (NSID 0x1) Id Fmt Data Metadt Rel_Perf 0 + 512 0 0 === START OF SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED SMART/Health Information (NVMe Log 0x02) Critical Warning: 0x00 Temperature: 37 Celsius Available Spare: 100% Available Spare Threshold: 10% Percentage Used: 0% Data Units Read: 223,023 [114 GB] Data Units Written: 286,175 [146 GB] Host Read Commands: 22,516,048 Host Write Commands: 22,648,134 Controller Busy Time: 2 Power Cycles: 18 Power On Hours: 1 Unsafe Shutdowns: 7 Media and Data Integrity Errors: 0 Error Information Log Entries: 0 Warning Comp. Temperature Time: 0 Critical Comp. Temperature Time: 0 Temperature Sensor 1: 37 Celsius Temperature Sensor 2: 36 Celsius Thermal Temp. 2 Transition Count: 2 Error Information (NVMe Log 0x01, max 64 entries) No Errors Logged

[参考]バッテリー状態(バッテリーへたり確認)

tool install&help

sudo apt install acpi $ acpi -h Usage: acpi [OPTION]... Shows information from the /proc filesystem, such as battery status or thermal information. -b, --battery battery information -i, --details show additional details if available: - battery capacity information - temperature trip points -a, --ac-adapter ac adapter information -t, --thermal thermal information -c, --cooling cooling information -V, --everything show every device, overrides above options -s, --show-empty show non-operational devices -f, --fahrenheit use fahrenheit as the temperature unit -k, --kelvin use kelvin as the temperature unit -d, --directory <dir> path to ACPI info (/sys/class resp. /proc/acpi) -p, --proc use old proc interface instead of new sys interface -h, --help display this help and exit -v, --version output version information and exit By default, acpi displays information on installed system batteries. Non-operational devices, for example empty battery slots are hidden. The default unit of temperature is degrees celsius. Report bugs to Michael Meskes <meskes@debian.org>.

フル充電状態:

$ acpi -V(大文字であることに注意) Battery 0: Full, 100% Battery 0: design capacity 4456 mAh, last full capacity 2401 mAh = 53% Adapter 0: on-line Thermal 0: ok, 32.0 degrees C Thermal 0: trip point 0 switches to mode critical at temperature 128.0 degrees C Cooling 0: Processor 0 of 10 Cooling 1: intel_powerclamp no state information available Cooling 2: Processor 0 of 10 Cooling 3: pch_skylake no state information available Cooling 4: Processor 0 of 10 Cooling 5: x86_pkg_temp no state information available Cooling 6: iwlwifi 0 of 20 Cooling 7: Processor 0 of 10 Cooling 8: iwlwifi_1 no state information available

放電中(ACアダプターを外している状態):

$ acpi -V Battery 0: Discharging, 99%, 06:57:56 remaining Battery 0: design capacity 4519 mAh, last full capacity 2435 mAh = 53% Adapter 0: off-line Thermal 0: ok, 36.0 degrees C Thermal 0: trip point 0 switches to mode critical at temperature 128.0 degrees C Cooling 0: Processor 0 of 10 Cooling 1: intel_powerclamp no state information available Cooling 2: Processor 0 of 10 Cooling 3: pch_skylake no state information available Cooling 4: Processor 0 of 10 Cooling 5: x86_pkg_temp no state information available Cooling 6: iwlwifi 0 of 20 Cooling 7: Processor 0 of 10 Cooling 8: iwlwifi_1 no state information available

以上の数値により、バッテリー状態は、53%で、約7時間くらい使用可能ということになる。
50%を割ったらバッテリーの交換時期と考えると、そろそろ交換時期ということになる。
(それでも、約7時間もつようなので、現状、そのまま使用する予定でいる)

[参考]バッテリー状態(バッテリ交換後)

実際の使用においてバッテリが持たなくなったので交換した。(2022/1/20)

ネットで「Lenovo レノボ ThinkPad X1 Carbon 交換用互換バッテリー 第5世代 (2017) 第6世代(2018) 向け 01AV429 01AV494 01AV430 01AV431 対応」で検索して、互換バッテリを入手した。

交換方法は「内蔵バッテリーの取り付け、取り外し - Thinkpad x1 Carbon
」を参照した。
バッテリ筐体の精度の問題だと思うが、PC本体のコネクタとの勘合が多少悪いようで、取り付けに多少手こずったが、なんとか固定できた。

充電中:

acpi -V Battery 0: Charging, 99%, 00:00:05 until charged Battery 0: design capacity 4343 mAh, last full capacity 4343 mAh = 100% Adapter 0: on-line Thermal 0: ok, 30.0 degrees C Thermal 0: trip point 0 switches to mode critical at temperature 128.0 degrees C Cooling 0: Processor 0 of 10 Cooling 1: intel_powerclamp no state information available Cooling 2: Processor 0 of 10 Cooling 3: pch_skylake no state information available Cooling 4: Processor 0 of 10 Cooling 5: x86_pkg_temp no state information available Cooling 6: iwlwifi 0 of 20 Cooling 7: TCC Offset 25 of 63 Cooling 8: Processor 0 of 10 Cooling 9: iwlwifi_1 no state information available

なぜか、「Charging, 100%」には、ならなかった。
「design capacity」と「last full capacity」のmAh値が同じなので、バッテリ交換が正常に行われたことを判断できる。

放電中(フル充電後、ACアダプターを外している状態):

acpi -V Battery 0: Discharging, 99%, 08:11:39 remaining Battery 0: design capacity 4516 mAh, last full capacity 4516 mAh = 100% Adapter 0: off-line Thermal 0: ok, 35.0 degrees C Thermal 0: trip point 0 switches to mode critical at temperature 128.0 degrees C Cooling 0: Processor 0 of 10 Cooling 1: intel_powerclamp no state information available Cooling 2: Processor 0 of 10 Cooling 3: pch_skylake no state information available Cooling 4: Processor 0 of 10 Cooling 5: x86_pkg_temp no state information available Cooling 6: iwlwifi 0 of 20 Cooling 7: TCC Offset 25 of 63 Cooling 8: Processor 0 of 10 Cooling 9: iwlwifi_1 no state information available

「design capacity」のmAh値が測定のたびに変動するのは、なぜか?

とりあえず、バッテリが持つようになったので、良しとする。

参照情報

ThinkPad X1 Carbonのマシンタイプの識別
シリアル番号の探し方 - マシンタイプ-モデル(製品番号)、シリアル番号(製造番号)が記載されたラベル
ThinkPad X1 Carbon ハードウェア保守マニュアル
ThinkPad X1 Carbon ユーザー・ガイド
BIOS (Boot Menu) からブートデバイスを選択する - ideapad, ThinkPad, ThinkStation, ThinkCentre, ideacentre
内蔵バッテリーの取り付け、取り外し - Thinkpad x1 Carbon

取り付け、取り外し動画 - ThinkPad X1 Carbon Gen 5 (20HQ, 20HR, 20K3, 20K4),ThinkPad X1 Carbon Gen 6 (20KG, 20KH)

SAMSUNG 1TB (980 MZ-V8V1T0B/IT)
SAMSUNG 500GB (980 MZ-V8V500B/IT)
SSDケース (HDE-13)
NVMe M.2 SSD + 外付けケースは安くて爆速!1GB/sの高速SSDストレージを低価格で!

たぶん解決済みだと思うが参考まで:
ThinkPad X1 Carbon第5世代ノートパソコン無償点検・修理のお知らせ

CrystalDiskMark 代替の KDiskMark(Linux) と AmorphousDiskMark(macOS)
CrazyDiskInfo is an interactive TUI S.M.A.R.T viewer for Unix systems. → ubuntu20.04では正常動作しなかった。

「CrystalDiskMark 8」がリリース!自作UIライブラリ「Project Priscilla」を採用
CrystalDiskInfo HDD/SSDの健康状態をチェック

SSD benchmark(@ThinkPad X1 Carbon)

以上

続きを読む "ThinkPad X1 Carbon(20HQ)にlinuxをインストールする"

| | コメント (0)

2021年1月 5日 (火)

ubuntu_Live_USBの作成方法

2021/1/5+
初版

ubuntu Live USB

ubuntu Live USB

概要

ubuntu_Live_USBの作成方法を記載する
(ホストはubuntuを想定している)

準備

真っさらなUSBストレージ(16GBくらい)か FAT32で初期化したUSBストレージを用意する。

手順

# Live USB に使用するISOフォーマットのディストリビューションをダウンロードする mkdir iso cd iso wget http://cdimage.ubuntulinux.jp/releases/20.04.1/ubuntu-ja-20.04.1-desktop-amd64.iso # unetbootin をインストールする sudo add-apt-repository ppa:gezakovacs/ppa sudo apt update sudo apt install unetbootin # 準備したUSBをホストPCに刺す # (間違って書き込まないために、他のUSBデバイスは外す) # 実行する sudo QT_X11_NO_MITSHM=1 /usr/bin/unetbootin # (1)起動したらラジオ・ボタンが2つあるので、 # ・「デストリビューション(ネットワークからダウンロード)」か # ・「ディスクイメージ(ローカルのISOファイルを指定)」をボタンで選ぶ。 # (2)「スペースは...(Ubuntuのみ)」のところは1024MBぐらいの値を入れる。 # (3)タイプ(USBドライブ)、ドライブ(/dev/sdxx) が、現在、刺しているUSBを示しているか確認する # (4)[OK]を押す

実行(書き込み)が完了するとUSB内のブートイメージができあがる。

注意:
ディストリビューションは日本語版を選ぶこと!
そうでないと起動した際にキーボードレイアウトが
日本仕様でなくなるので記号入力が困難になる。

参考情報

UNetbootin : Create bootable Live USB drives for Windows and MacOS
UbuntuでUbuntuのLive USBの作成する

以上

続きを読む "ubuntu_Live_USBの作成方法"

| | コメント (0)

2020年10月10日 (土)

ubuntu20.04でwindowアプリを動かす

2020/10/10:
初版

wine ubuntu20.04

wine ubuntu20.04

概要

ubuntu20.04でwindowアプリを動かす。
(wineでwindowsアプリを動かす)

インストール

(1)wineのインストール
以下を実行する:

sudo apt install wine

(2)windowsアプリのダウンロード
以下の手順でインストールする:
ここでは参考として、sakura,teratermをダウンロードする。

cd ~/Download wget https://ja.osdn.net/projects/sakura-editor/downloads/72243/sakura-tag-v2.4.0-build2686-782347a-Win32-Release-Installer.zip unzip sakura-tag-v2.4.0-build2686-782347a-Win32-Release-Installer.zip wget https://ja.osdn.net/projects/ttssh2/downloads/72009/teraterm-4.105.exe

(3)windowsアプリのインストール

wine sakura_install2-4-0-2686-x86.exe wine teraterm-4.105.exe # メニュー表示されて文字化けしているが、 # 本当のwindowsでのメニューを参考にしてボタンを押してインストールする

インストールすると、以下のディレクトリに本来のwindows同様のファイルが置かれる:

$ ls ~/.wine/drive_c/ 'Program Files' 'Program Files (x86)' ProgramData users windows

(4).bashrcに登録する
以下を.bashrcを追加する:

# wine app alias sakura='wine-stable "c:\Program Files (x86)\sakura\sakura.exe"' alias teraterm='wine-stable "c:\Program Files (x86)\teraterm\ttermpro.exe"'

これを登録するとコマンドラインで、sakura,teratermと入力すると
そのwindowsアプリが起動する。

以上

続きを読む "ubuntu20.04でwindowアプリを動かす"

| | コメント (0)

2020年10月 8日 (木)

Teensy3.6ボードでTinyGOを動かす

2020/10/8:
初版

TinyGO Install Teensy3.6

TinyGO Install Teensy3.6

概要

以下のTeensy3.6ボードでTinyGOを動かす。
tinygo_0.15.0でteensy3.6がサポートされたので、それをインストールして使ってみる。
まだ、実装途上のようで、GPIO,UARTのみのようである。USBシリアル(USB CDC serial port)はサポートされない。
なお、ホストPCとしてはubuntu20.04を想定している。

Teensy 3.6

準備

以下のツールを予めインストールする:
(0)udev設定
以下を実行する:

curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/master/scripts/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules sudo udevadm control --reload-rules sudo usermod -a -G dialout $USER sudo usermod -a -G plugdev $USER

(1)TinyGOのインストール
以下の手順でインストールする:

mkdir tinygo_ws cd tinygo_ws wget https://github.com/tinygo-org/tinygo/releases/download/v0.15.0/tinygo_0.15.0_amd64.deb sudo dpkg -i tinygo_0.15.0_amd64.deb export PATH=$PATH:/usr/local/tinygo/bin # xiaoには不要だが、ターゲットがarduinoのときに # 必要となるツールをついでにインストールする sudo apt-get install gcc-avr sudo apt-get install avr-libc sudo apt-get install avrdude

(2)GOのインストール
TinyGOのモジュールを使用するのにGOが必要なので 予めインストールする。
(ただし、TinyGOとの整合性により最新版ではない)

wget https://dl.google.com/go/go1.13.7.linux-amd64.tar.gz sudo tar -C /usr/local -xzf go1.13.7.linux-amd64.tar.gz export PATH=$PATH:/usr/local/go/bin export GOPATH=$HOME/tinygo_ws

なお、GOPATHのパス設定値は、任意だが、それをベースに その配下にTinyGO/GOの関係ファイル/ディレクトリが置かれる。

(3)teensy書き込みツールのインスール
以下の手順でインストールする:

mkdir teensy_loader_cli cd teensy_loader_cli sudo apt-get install libusb-dev wget https://raw.githubusercontent.com/PaulStoffregen/teensy_loader_cli/master/Makefile wget https://raw.githubusercontent.com/PaulStoffregen/teensy_loader_cli/master/teensy_loader_cli.c make sudo cp teensy_loader_cli /usr/bin/

以上のexportは、.bashrcに登録する。

(4)export登録(まとめ)
以下を.bashrcに追加する:

# tinygo/go export PATH=$PATH:/usr/local/go/bin export PATH=$PATH:/usr/local/tinygo/bin export GOPATH=$HOME/tinygo_ws export TIGOLIBS=$GOPATH/src/tinygo.org/x/drivers/

examples/blinky1を動かす

teensy3.6ボードをPCに接続して、以下を実行する:

tinygo flash -size full -target teensy36 examples/blinky1 <省略> (hint: press the reset button) #以上のメッセージが表示されたら、ボードのRESETボタンを押す <省略> Programming........ Booting

コンパイルと書き込み実行が自動的に行われ、ボードのLEDが点滅する。

任意のプログラムを動かす

(1)以下のようにプロジェクト用ディレクトリを作成する:

cd tigo_ws mkdir blink cd blink

(2)プロジェクト(blink)ディレクトリに以下のファイルを作成する:
main.go

package main // This is the most minimal blinky example and should run almost everywhere. import ( "machine" "time" ) func main() { led := machine.LED led.Configure(machine.PinConfig{Mode: machine.PinOutput}) for { led.Low() time.Sleep(time.Millisecond * 100) led.High() time.Sleep(time.Millisecond * 100) } }

(3)ビルド実行
teensy3.6ボードをPCに接続して以下を実行する:

tinygo flash -size full -target teensy36 . <省略> (hint: press the reset button) #以上のメッセージが表示されたら、ボードのRESETボタンを押す <省略> Programming........ Booting

コンパイルと書き込み実行が自動的に行われ、ボードのLEDが点滅する。
(example/blinky1と区別しにくいと思うので、点滅周期を変更して実行してみる)

参考情報

Teenst3.6 Pinout:
https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/teensy36_front.pdf
https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/teensy36_back.pdf

https://github.com/tinygo-org/tinygo
https://tinygo.org/
https://tinygo.org/getting-started/linux/

Seeeduino XIAO用Grove シールド バッテリー管理チップ 搭載

ESP32 and ESP8266 support in TinyGo

コンピュータボードでTinyGOを動かす
docker/TinyGO Helper Script
TinyGOでLightSensorを動かす

TinyGoで始める組み込みプログラミング
TinyGo on Arduino Uno: An Introduction

Circuit Playground Express
Adafruit Circuit Playground Express - Overview
Infrared Receive and Transmit with Circuit Playground Express

Adafruit Circuit Playground Express - PINOUT
Adafruit Circuit Playground Express Pin Assign

NUCLEO-F103RB mbed pinout
NUCLEO-F103RB Pin Assign
STM32F4DISCO Pin Assign
MICROBIT Pin Assign
ARDUINO-NANO Pin Assign
ARDUINO Pin Assign

TinyGo Drivers

USB Flashing Format (UF2)

XIAO Schematic(zip)
How to use Seeeduino XIAO to log in to your Raspberry PI

以上

続きを読む "Teensy3.6ボードでTinyGOを動かす"

| | コメント (0)

2020年10月 4日 (日)

ubuntu20.04をインストールする

2021/2/17:
「開発ツールに関係するインストール」を追加した。

2020/10/12:
bluetoothの動かし方を追加した。

2020/10/3:
初版

ubuntu20.04 install

ubuntu20.04 install

概要

ubuntu20.04をインストールする。
日経Linux(2020/9)のインストールDVDを使用して、新規にPCのHDDをSSDに換装してインストールした際の注意事項などをまとめた。

注意事項/留意事項

(1)DVDインストールの際にハードに依存したモジュールなどのインストールをするオプションを使用しないこと。PCのハードウェアに依存すると思うが、再ブート時にエラーになりlinuxが起動しなくなる。
(2)SNAPベースのアプリのインストールがサポートされたが、実際に使用した印象では完成度が低いので、従来の「sudo apt install xxxx」を使用する。
例)leafpadはsnapベースだがインストール後、起動するが、エラーが起きて使いものならなかった。VLCは、間違えてインストール・ボタンを2度押したらエラーが出て、インストールできなくなった。
(3)bluetoothが動作していない。(古いバージョンのutbuntuでは動作していた)
(4)python3.xに移行したようで、python2.xはデフォルトではインストールされていない。

最初にやること(ディクトリの英語化)

ホームディレクトリ内のディレクトリ名を英語表記にするには
以下を実行する:

LANG=C xdg-user-dirs-gtk-update

ウィンドウが開くので、" Don't ask me this again " にチェックを入れて、 [ Update Names ] をクリックする。

問題のあったアプリのインストール方法

leafpad

以下、実行する:

sudo apt install gdebi wget http://archive.ubuntu.com/ubuntu/pool/universe/l/leafpad/leafpad_0.8.18.1-5_amd64.deb # debファイルを左クリックしてgdebiインストーラーを起動する

参照:「Ubuntu 20.04にSnap版ではなくdebパッケージ版のLeafpadをインストール (Snap版のLeafpadで不具合発生)

VLC

以下、実行する:

sudo apt install vlc sudo apt install vlc-plugin-access-extra libbluray-bdj libdvdcss2 #このインストール後、「libdvd-pkg: `apt-get check`」失敗のようなエラーが出るようになるなら以下を実行する sudo dpkg-reconfigure libdvd-pkg

参照:「libdvd-pkg: apt-get checkが失敗しました。パッケージが壊れている可能性があります。

bluetooth

まだ、解決していないが、以下のリンクが参考になるかもしれない(いうまでもなく、動作することは保証しない)
Ubuntu 20.04 bluetooth not working
Miix2 8のLubuntu20.04LTS設定方法

私のハードウェアの場合、以下のようなエラーが出ているようだ:

$ dmesg | grep -i bluetooth [ 3.101690] Bluetooth: Core ver 2.22 [ 3.101707] Bluetooth: HCI device and connection manager initialized <省略> [ 3.274510] bluetooth hci1: Direct firmware load for brcm/BCM20702A1-0a5c-21e6.hcd failed with error -2 [ 3.274513] Bluetooth: hci1: BCM: Patch brcm/BCM20702A1-0a5c-21e6.hcd not found <省略> [ 24.820848] Bluetooth: RFCOMM ver 1.11

その他のインストール

以下、必要そうなものを以下のようにインストールした:

sudo apt install net-tools sudo apt install picocom sudo apt install python3-distutils sudo apt install python3-venv sudo apt install curl sudo apt install git

開発ツールに関係するインストール

sudo apt update sudo apt install cmake sudo apt install libusb-dev sudo apt install libusb-1.0-0-dev # lib for Arduino IDE for microbit sudo apt install libudev1:i386 # for Arduino IDE for ESP32/ESP8266 sudo apt install python-is-python3 pip install pyserial pip uninstall serial

参照:
Fixing the Arduino IDE for the ESP32/ESP8266 on Ubuntu 20.04

追記(bluetoothの動かし方)

以下の手順でbluetoothを動かすことができた:

sudo apt install blueman bluetoothctl # bluetoothctrlが起動したら以下のコマンドを実行する: # scan on # pair xxxxx # (xxxxxは、ペアリングしたいデバイスのアドレス) # quit

以上で希望のデバイスのペアリングができる。
ubuntuを再起動すると最上行にbluetoothのアイコンが出現するので それをクリックすことで他のデバイスのペアリングなどができる。
ペアリング済みのキーボードなどは再起動しても、自動的に接続される。

推測になるが、私の環境では、内蔵のbluetoothとble用にUSBドングルを刺しているが 内蔵のものがエラーになっていて、USBドングルのものはbluemanで起動できているようだ。
したがって、標準の設定/bluetoothでは(内臓のもののみに対応しているらしく) デバイス名を表示しない。
bluetoohアイコン(blueman)のものは、内蔵とUSBドングルに対応しているので USBドングルに切り替えて使用する。

参考情報

bluetooth関係:

https://qiita.com/propella/items/6daf3c56e26f709b4141
Linux のコマンドラインで Bluetooth 接続

https://mumeiyamibito.0am.jp/bluetoothctl
無銘闇人の備忘録/bluetoothctl

https://askubuntu.com/questions/1231074/ubuntu-20-04-bluetooth-not-working
Ubuntu 20.04 bluetooth not working

https://blog.goediy.com/?p=441
Miix2 8のLubuntu20.04LTS設定方法

https://qiita.com/maachan_9692/items/256adb8f83e7658d51d5
ubuntu 20.04 でSONY のヘッドホンWH-1000XM4 をLDAC で接続したい!!

https://freefielder.jp/blog/2016/07/ubuntu-bluetooth-tethering.html
Ubuntu / CHIP】Bluetoothテザリング接続をコマンドラインから。

以上

続きを読む "ubuntu20.04をインストールする"

| | コメント (0)