Mais conteúdo relacionado Semelhante a Raspberry pi 基本操作 (20) Raspberry pi 基本操作4. Pi 3 Hardware Spec.
SoC:BroadcomBCM2837(CPU,GPU DSP,SDRAM, USB)
CPU: Quad ARM Cortex A53 (ARMv8-A)@1.2GHz
GPU: Broadcom VideoCore IV@400MHz, OpenGL ES 2.0,
1080p 30 h.264/MPEG-4 AVC高畫質解碼器
RAM: 1 G SDRAM
內建 802.11n W-Fi + Bluetooth 4.0
Power: 5V 2.5A
8. 製作Pi 的 Image
• Step 1: 下載Pi image (RASPBIAN JESSIE)
• http://www.raspberrypi.org/downloads/
• Step 2: 在PC上 利用win32 Disk Imager工具將.img檔
寫入SD卡
9. SD Card內容
Pi’s Embedded Linux組成
Boot code
Linux Kernel
Root File system
Boot code
kernel
Root FileSystem
mmcblock0p1
/boot
mmcblock0p2
/
資料來源: https://goo.gl/VrjL9b
FAT32
EXT4
10. 使用UART Console 登入Raspberry Pi Linux
紅色Raspberry Pi Shield上內建 USB-to-Serial (PL2303)晶片, 故可以用電腦透過
USB界面連接到Raspberry Pi
PL2303
USB Power (5V)
11. 軟體安裝
Step1: 安裝 PL2303 Driver
Step2: 安裝 TeraTerm 終端機連線軟體
Step3: 終端機連線設定
Note:
Pi 3 須將/boot/config.txt 的檔案, 加入
core_freq=250
dtoverlay=pi3-miniuart-bt
enable_uart=1
16. Linux 基本操作命令
ls -l <dir> # list 目錄內容
cd <dir> #改變工作目錄
pwd #顯示目前所在工作目錄位置
cp -a <src> <dst> #copy 檔案
mkdir <dir> # 產生目錄
rm -rf <dir> #刪除目錄(含子目錄)
cat <file> #顯示檔案內容
ln -s <src> <dst> #建立Softlink (捷徑)
unzip xxx.zip #解壓縮zip檔
tar zcvf xxx.tar.gz <dir> #製作tar.gz 壓縮包
tar zxvf xxx.tar.gz # 解tar.gz壓縮包
17. Linux 基本操作命令
ifconfig #檢視所有網路卡狀態
ping <ip> ; #確認是否可以連到某個ip ctrl+C 停止
passwd #變更登入密碼
passwd <user> #變更某User的登入密碼
whoami #顯示登入帳號
sudo <command> #以 root身份執行此命令
sudo apt-get install <package> # 線上安裝軟體套件
sudo reboot # Reset Pi
sudo shutdown -h now # 關機
ps -aux ; kill -9 <PID> #顯示系統上所有的執行程式
su #切換成root
24. 允許root使用SSH 密碼登入
Normally ssh does not allow root access because this
is considered a security risk
作法:
sudo passwd root 設定root登入密碼
sudo nano /etc/ssh/sshd_config
找到 “#PermitRootLogin without-password” , 改
成”PermitRootLogin yes”
25. 設定Pi 3 Wi-Fi
# Site Survey (AP Scan)
sudo iwlist wlan0 scan
#連接AP
sudo raspi-config 進入[Network Options]Wi-Fi
27. Wi-Fi 功能開關
# 停止Wi-Fi
sudo ifdown wlan0
# 啓用Wi-Fi
sudo ifup wlan0
You can verify if it has successfully connected using
ifconfig wlan0
29. Pi 校時
Synchronize and set computers’ date and time by
querying a Network Time Protocol (NTP) server
sudo apt-get install ntpdate
sudo ntpdate ntp.ubuntu.com
30. Pi 開機自動執行程式
在/etc/init.d 放上一個 Script, 並且可以執行你要執行的程式
/etc/init.d/myprogram start
/etc/init.d/myprogram stop
myprogram
sudo chmod +x myprogram
sudo cp pi-sensor/example/blink/gpio /bin/gpio
31. run at startup
加入: sudo update-rc.d myprogram defaults
移除: sudo update-rc.d –f myprogram remove
32. Useful Links
• https://www.raspberrypi.org
• BCM2835 Low-Level I/O Library
http://www.airspayce.com/mikem/bcm2835/
• BCM2835 DataSheet
• 用Raspberry Pi 學Linux 驅動程式開發
http://blog.ittraining.com.tw/2015/05/raspberry-pi-b-pi2-linux-gpio-button.html
• PIR感測電路應用設計
http://blog.ittraining.com.tw/2016/08/raspberry-pi-pir.html
• 用Raspberry Pi 學嵌入式系統開發
https://goo.gl/VrjL9b
• 用Raspberry Pi 學ARM Bootloader 程式開發
https://goo.gl/eNEuUk
• 艾鍗BLOG
http://blog.ittraining.com.tw/