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.

250 lines
12 KiB

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