Blame
|
1 | # Linux |
||||||
| 2 | ||||||||
|
3 | This is written for debian, raspian or ubuntu. You'll have to make the usual adjustments if you're using something else. |
||||||
| 4 | ||||||||
|
5 | ## Update your OS |
||||||
| 6 | ||||||||
|
7 | First, update and upgrade your OS |
||||||
|
8 | |||||||
|
9 | ``` |
||||||
| 10 | sudo apt update |
|||||||
|
11 | sudo apt upgrade -y |
||||||
|
12 | ``` |
||||||
|
13 | |||||||
|
14 | ## Access to USB Serial |
||||||
| 15 | ||||||||
|
16 | Add your user to the dialout group, change `$USER` to your user name. This allows your user to access the USB serial device. |
||||||
|
17 | |||||||
| 18 | ``` |
|||||||
| 19 | sudo usermod -a -G dialout $USER |
|||||||
| 20 | ``` |
|||||||
|
21 | |||||||
|
22 | You'll need to logout and back in again. |
||||||
|
23 | |||||||
| 24 | ## Flash the companion |
|||||||
| 25 | ||||||||
|
26 | > [!NOTE] |
||||||
| 27 | > If you've already flashed your companion with the MeshCore firmware you can skip this step. |
|||||||
|
28 | |||||||
|
29 | > [!IMPORTANT] |
||||||
| 30 | > Make sure you flash with "Companion USB" not "Companion Bluetooth" |
|||||||
| 31 | ||||||||
|
32 | > [!NOTE] |
||||||
|
33 | > TODO find out how to do this on the CLI |
||||||
|
34 | |||||||
| 35 | ## Install needed software |
|||||||
| 36 | ||||||||
|
37 | Install pipx, make sure the bin dir is in the path, then install [[Meshcore-Cli|Meshcore/Meshcore-Cli]] |
||||||
|
38 | |||||||
| 39 | ``` |
|||||||
| 40 | sudo apt install pipx |
|||||||
|
41 | pipx ensurepath |
||||||
|
42 | pipx install meshcore-cli |
||||||
|
43 | |||||||
| 44 | or |
|||||||
| 45 | ||||||||
| 46 | sudo pipx install meshcore-cli --global |
|||||||
|
47 | ``` |
||||||
|
48 | |||||||
| 49 | Logout and back in again. |
|||||||
| 50 | ||||||||
| 51 | ## Find the USB device |
|||||||
| 52 | ||||||||
| 53 | ``` |
|||||||
| 54 | meshcli -l |
|||||||
| 55 | ``` |
|||||||
| 56 | ||||||||
| 57 | Output probably looks like this, you'll want to use the USB one: |
|||||||
| 58 | ||||||||
| 59 | ``` |
|||||||
| 60 | BLE devices: |
|||||||
| 61 | No BLE HW |
|||||||
| 62 | ||||||||
| 63 | Serial ports: |
|||||||
| 64 | /dev/ttyS0 n/a [n/a] |
|||||||
| 65 | /dev/ttyUSB0 CP2102 USB to UART Bridge Controller - CP2102 USB to UART Bridge Controller [USB VID:PID=10C4:EA60 SER=0001 LOCATION=1-1] |
|||||||
| 66 | ``` |
|||||||
|
67 | |||||||
|
68 | ## Create serial based symlink |
||||||
| 69 | ||||||||
| 70 | This creates `/dev/meshcore0` using your devices serial number, which is much more reliable than `ttyUSB0` or `ttyACM0` which can change. |
|||||||
| 71 | ||||||||
| 72 | If you want to change to a different board, you'll have to create `meshcore1` or update these values. |
|||||||
| 73 | ||||||||
| 74 | ``` |
|||||||
| 75 | sudo udevadm info -a -n /dev/ttyUSB0 | vi - |
|||||||
| 76 | ``` |
|||||||
| 77 | ||||||||
| 78 | Look for ATTRS{serial} and ATTRS{idVendor}: |
|||||||
| 79 | ||||||||
| 80 | ``` |
|||||||
| 81 | ATTRS{idVendor}=="303a" |
|||||||
| 82 | ATTRS{serial}=="332AC33C8CDC" |
|||||||
| 83 | ``` |
|||||||
| 84 | ||||||||
|
85 | Then open this file: |
||||||
| 86 | ||||||||
|
87 | ``` |
||||||
| 88 | sudo vi /etc/udev/rules.d/99-meshcore.rules |
|||||||
| 89 | ``` |
|||||||
| 90 | ||||||||
| 91 | put a line in similar to this: |
|||||||
| 92 | ||||||||
| 93 | ``` |
|||||||
| 94 | SUBSYSTEM=="tty", ATTRS{idVendor}=="303a", ATTRS{serial}=="332AC33C8CDC", SYMLINK+="meshcore0" |
|||||||
| 95 | ``` |
|||||||
| 96 | ||||||||
| 97 | run the following: |
|||||||
| 98 | ||||||||
| 99 | ``` |
|||||||
| 100 | sudo udevadm control --reload-rules |
|||||||
| 101 | sudo udevadm trigger |
|||||||
| 102 | ``` |
|||||||
| 103 | ||||||||
|
104 | ## Start MeshCLI |
||||||
| 105 | ||||||||
| 106 | ``` |
|||||||
|
107 | meshcli -s /dev/meshcore0 |
||||||
|
108 | ``` |
||||||
| 109 | ||||||||
| 110 | ### Configure node |
|||||||
| 111 | ||||||||
| 112 | Do basic companion configuration. You should only need to do this once, unless you want to change these settings: |
|||||||
|
113 | |||||||
|
114 | ``` |
||||||
|
115 | meshcore-cli -s /dev/meshcore0 set radio 915.800,250,11,5 |
||||||
|
116 | or |
||||||
| 117 | meshcore-cli -s /dev/meshcore0 set radio 915.075,125,9,5 |
|||||||
| 118 | ||||||||
|
119 | meshcore-cli -s /dev/meshcore0 set name "🦷 rdm cli 0" |
||||||
| 120 | meshcore-cli -s /dev/meshcore0 advert |
|||||||
|
121 | ``` |
||||||