You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

252 lines
12 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. * Issues to solve [0%]
  2. ** TODO which version of beagles to buy
  3. - I prefer to use the beaglebone black wi-fi, if it is possible to connect them to Jade's internet
  4. - Otherwise the ethernet version is preferred to use with usb-internet sharing
  5. - Install in computer the PuTTY software and some bash option to use.
  6. ** TODO Adding to day 1: https://linuxpropaganda.wordpress.com/2018/06/26/create-new-user-in-ubuntu-on-beaglebone-black/
  7. *
  8. * day-1: Introduction to the beagle-boards and basic applications
  9. ** Introduction to the beagle boards.
  10. *** Connection
  11. + Basic USB connection
  12. + Connect to a IP address
  13. + SSH connection
  14. ssh -X debian@192.168.7.2
  15. debian:temppwd
  16. *** Error connection
  17. When getting the error:
  18. #+begin_src
  19. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  20. @ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
  21. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  22. The ECDSA host key for beaglebone.local has changed,
  23. and the key for the corresponding IP address 2806:103e:5:50f4:3ad2:69ff:fef9:46b4
  24. #+end_src
  25. you have to edit the '.ssh/known_hosts' file, and delete the lien that contains the offending key and the corresponding IP address given the warning.
  26. *** Sharing the internet through usb
  27. *** Wi-Fi
  28. To connect to your Wireless network type the following command in the terminal window:
  29. #+begin_src
  30. $sudo connmanctl
  31. connmanctl> enable wifi
  32. Enabled wifi
  33. connmanctl> scan wifi
  34. Scan completed for wifi
  35. connmanctl> services
  36. wifi_506583d4fc5e_544e434150413937414239_managed_psk
  37. connmanctl> agent on
  38. Agent registered
  39. connmanctl> connect wifi_506583d4fc5e_544e434150413937414239_managed_psk
  40. Passphrase? xxxxxxxxxxx
  41. connected wifi_506583d4fc5e_544e434150413937414239_managed_psk
  42. connmanctl> quit
  43. $ping www.google.com
  44. #+end_src
  45. ** Beagle software
  46. *** Basic File System Commands
  47. | Name | Command | options | example |
  48. |-------------------+---------+---------------------------------------+----------------------------------|
  49. | List files | ls | -a shows all | ls -la |
  50. | | | -l long format | |
  51. | | | -R recursive | |
  52. |-------------------+---------+---------------------------------------+----------------------------------|
  53. | Current directory | pwd | -P prints the physical location | pwd |
  54. |-------------------+---------+---------------------------------------+----------------------------------|
  55. | Change | cd | .. takes you up a level | cd /home/gmarx |
  56. | directory | | ~ takes you to home directory | cd ~ |
  57. |-------------------+---------+---------------------------------------+----------------------------------|
  58. | Make | mkdir | -p make parent directories as needed | mkdir -p test/example |
  59. | directory | | -v print a message for each directory | mkdir -p /test/example |
  60. | | | | *first example creates |
  61. | | | | folders inside the |
  62. | | | | current folder, other one |
  63. | | | | creates folder in root directory |
  64. |-------------------+---------+---------------------------------------+----------------------------------|
  65. | Delete a | rm | -r recursive (use for directories) | rm sample.txt |
  66. | file or directory | | -d remove empty directory | rm -r test |
  67. |-------------------+---------+---------------------------------------+----------------------------------|
  68. | Copy a file | cp | -r recursivec copy | cp a.txt b.txt |
  69. | or directory | | -u copy only if the source is newer | cp test-a test-b |
  70. | | | -v verbose (show output) | |
  71. |-------------------+---------+---------------------------------------+----------------------------------|
  72. | Move a file or | mv | -i prompts before overwrite | mv a.txt c.txt |
  73. | directory | | No -r; Moving into the same directory | mv test example |
  74. | | | performs a renaming | |
  75. |-------------------+---------+---------------------------------------+----------------------------------|
  76. | | touch | | |
  77. |-------------------+---------+---------------------------------------+----------------------------------|
  78. | | more | | |
  79. |-------------------+---------+---------------------------------------+----------------------------------|
  80. | | cal | | |
  81. |-------------------+---------+---------------------------------------+----------------------------------|
  82. | | | | |
  83. *** Terminal
  84. | Command | Description |
  85. |---------+------------------------|
  86. | CTRL-c | Stop current command |
  87. | CTRL-z | Sleep program |
  88. | CTRL-a | Go to start of line |
  89. | CTRL-e | Go to end of line |
  90. | CTRL-u | Cut from start of line |
  91. | CTRL-k | Cut to end of line |
  92. | CTRL-r | Search history |
  93. | !! | Repeat last command |
  94. | Tab key | Autocompletes |
  95. | | |
  96. |---------+------------------------|
  97. *** Package management
  98. | Command | Debian |
  99. |------------------------------------+----------------------|
  100. | Install a package | sudo apt install vim |
  101. | Upgrade the package in your system | sudo apt upgrade |
  102. | | |
  103. |------------------------------------+----------------------|
  104. | | |
  105. *** Basic file editing with VIM
  106. *** Expanding the file system
  107. with 'lsblk':
  108. #+begin_src
  109. debian@beaglebone:~$ lsblk
  110. NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
  111. mmcblk0 179:0 0 28.9G 0 disk
  112. `-mmcblk0p1 179:1 0 3.5G 0 part /
  113. mmcblk1 179:8 0 3.6G 0 disk
  114. `-mmcblk1p1 179:9 0 3.6G 0 part
  115. mmcblk1boot0 179:16 0 2M 1 disk
  116. mmcblk1boot1 179:24 0 2M 1 disk
  117. mmcblk1rpmb 179:32 0 512K 0 disk
  118. debian@beaglebone:~$
  119. #+end_src
  120. then df -k:
  121. #+begin_src
  122. debian@beaglebone:~$ df -k
  123. Filesystem 1K-blocks Used Available Use% Mounted on
  124. udev 220088 0 220088 0% /dev
  125. tmpfs 49496 5628 43868 12% /run
  126. /dev/mmcblk0p1 3558936 2233396 1125044 67% /
  127. tmpfs 247468 0 247468 0% /dev/shm
  128. tmpfs 5120 4 5116 1% /run/lock
  129. tmpfs 247468 0 247468 0% /sys/fs/cgroup
  130. tmpfs 49492 0 49492 0% /run/user/1000
  131. #+end_src
  132. we have to use some tools at '/opt/scripts/tools/'
  133. #+begin_src
  134. debian@beaglebone:/opt/scripts/tools$ sudo ./grow_partition.sh
  135. [sudo] password for debian:
  136. Media: [/dev/mmcblk0]
  137. sfdisk: 2.26.x or greater
  138. Disk /dev/mmcblk0: 28.9 GiB, 31016878080 bytes, 60579840 sectors
  139. Units: sectors of 1 * 512 = 512 bytes
  140. Sector size (logical/physical): 512 bytes / 512 bytes
  141. I/O size (minimum/optimal): 512 bytes / 512 bytes
  142. Disklabel type: dos
  143. Disk identifier: 0xbecca426
  144. ...
  145. sudo reboot
  146. #+end_src
  147. Now is sure to update packages or kernel with 'sudo apt upgrade', and 'uname -a'.
  148. ** Developing applications
  149. *** On-Board LEDs
  150. first go to:
  151. #+begin_src
  152. cd /sys/class/leds/
  153. #+end_src
  154. then, follow the next commands for the ~beaglebone:green:usr3~:
  155. #+begin_src
  156. debian@beaglebone:/sys/class/leds$ ls
  157. beaglebone:green:usr0 beaglebone:green:usr2 wl18xx_bt_en
  158. beaglebone:green:usr1 beaglebone:green:usr3
  159. debian@beaglebone:/sys/class/leds$ cd beaglebone\:green\:usr3
  160. debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ ls
  161. brightness device max_brightness power subsystem trigger uevent
  162. debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ cat trigger
  163. none rc-feedback rfkill-any kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock usb-gadget usb-host mmc0 [mmc1] mmc2 timer oneshot disk-activity ide-disk mtd nand-disk heartbeat backlight gpio cpu cpu0 activity default-on panic netdev bluetooth-power hci0-power rfkill0 rfkill1 phy0rx phy0tx phy0assoc phy0radio
  164. debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ echo none > trigger
  165. debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ echo 1 > brightness
  166. debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ echo 0 > brightness
  167. debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$
  168. #+end_src
  169. In this case, ~cat trigger~ results in a *[mmc1]*, and it is necessary to change its state, first to ~none~, then we are able to modify its brightness by echoing 1 or 0 to this *sysfs* virtual file system.
  170. Delay example:
  171. #+begin_src
  172. echo timer > trigger
  173. debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ cat trigger
  174. none rc-feedback rfkill-any kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock usb-gadget usb-host mmc0 mmc1 mmc2 [timer] oneshot disk-activity ide-disk mtd nand-disk heartbeat backlight gpio cpu cpu0 activity default-on panic netdev bluetooth-power hci0-power rfkill0 rfkill1 phy0rx phy0tx phy0assoc phy0radio
  175. debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ ls
  176. brightness delay_on max_brightness subsystem uevent
  177. delay_off device power trigger
  178. debian@beaglebone:/sys/class/leds/beaglebone:green:usr3$ cat delay_on
  179. 500
  180. #+end_src
  181. *** Shutdown
  182. #+begin_src
  183. >sudo shutdown -h now
  184. >sudo shutdown -h +5
  185. >sudo reboot
  186. #+end_src
  187. *** Node.js, Cloud9, and BoneSccript
  188. The BeagleBoard.org Linux distribution comes complete with a set of technologies that you can use to quickly get started with developing software and hardware applications on the boards. These are called Node.js, Cloud9, and BoneScript. *Node.js* is a programming language, *Cloud9* is an online software integrated development environment (IDE) in which you can write *Node.js* code, and *BoneScript* is a library of code for Node.js that allows you to interact with Beagle board hardware[Molloy@2019].
  189. **** Node.js
  190. Node.js is a platform for building network applications that uses the same JavaScript engine as the Google Chrome web browser. JavaScript is the programming language that is often used to create interactive interfaces within web pages.
  191. #+begin_src
  192. debian@beaglebone:~$ cd es-jade/
  193. debian@beaglebone:~/es-jade$ mkdir node-test
  194. debian@beaglebone:~/es-jade$ cd node-test/
  195. debian@beaglebone:~/es-jade$ vi hello-jade.js
  196. #+end_src
  197. In the file add the next line of code:
  198. #+begin_src
  199. console.log("Hello World!");
  200. #+end_src
  201. Then, run the script by using the ~node~ command:
  202. #+begin_src
  203. debian@beaglebone:~/es-jade/node-test$ node hello-jade.js
  204. Hello Jade-HS and world
  205. #+end_src
  206. The call to the ~node~ command works because the Node.js runtime environment is preinstalled on the BeagleBoard.org Linux image.
  207. Now lets try a more complex script; a web server.
  208. ** The linux file system and commands
  209. * day-2: Control versions and interfacing electronics
  210. ** git for control version2
  211. ** C and C++
  212. ** GPIO interfacing
  213. ** 4. Bone scripts
  214. ** UART communication
  215. * day-3: The internet of things
  216. ** A beagle board IoT sensor
  217. ** Sensor web server
  218. ** Linux cron scheduler
  219. ** QT rich user interface
  220. * day-4: The project
  221. ** project development