2017-03-06
Kernel Building for Raspberry pi (ARM CPU)
2. [進階] 編譯 Raspberry Pi 的核心 OR KERNEL BUILDING : DOCUMENTATION > LINUX > KERNEL > BUILDING
raspberrypi-tools 是 32bits 的,所以在 debian wheezy amd64 要裝上 32bits 的程式庫。
$ sudo apt-get install libc6-i386 lib32stdc++6 lib32z1
裝好後,試試看指令能不能執行
$ arm-linux-gnueabihf-gcc
arm-linux-gnueabihf-gcc: fatal error: no input files
compilation terminated.
這樣 no input files 就是正常可執行的狀況
-bash: /opt/cross/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc: No such file or directory
若出現 No such file or directory 則應該是 32bits 程式庫沒裝好,再用 ldd 檢查一下。
armel和armhf區別選擇
fpu單元
- soft:不用fpu計算,即使有fpu浮點運算單元也不用。
- armel:也即softfp,用fpu計算,但是傳參數用普通寄存器傳,這樣中斷的時候,只需要保存普通寄存器,中斷負荷小,但是參數需要轉換成浮點的再計算。
- armhf:也即hard,用fpu計算,傳參數用fpu中的浮點寄存器傳,省去了轉換性能最好,但是中斷負荷高。
armel與armhf
安裝armel和armhf
arm-linux-gnueabi的安裝 (debian synaptic supported)
sudo apt-get install gcc-arm-linux-gnueabi
arm-linux-gnueabihf的安裝 (debian synaptic supported)
- linaro開源組織有相關的交叉工具鏈下載,點擊進入網頁選擇下載即可,地址:https://launchpad.net/linaro-toolchain-binaries。
- 到本站工具鏈頁面下載,地址:http://www.veryarm.com/arm-linux-gnueabihf-gcc。
armhf 使用
2016-08-25
樹莓派的GPIO接口輸出電流限制

這些接口可配置成輸入或輸出。本文主要討論GPIO引腳作為輸出時電流的限制。
阻抗 (impendance)
阻抗和和電阻的區別(resistance)在於電阻的阻值是固定的,不會隨著電流變化,阻抗則不然,可能隨著外部變化,如電流或頻率變化。從另一個角度來說,電阻是線性的,但阻抗不是。比如放大器的阻抗會隨著輸出的信號頻率變化。
樹莓派的的每個GPIO引腳都有一個寄存器可以設置引腳的驅動強度,也就是在保持輸出電壓為邏輯0和1的情況下,可以改變阻抗的大小從而改變GPIO引腳的輸出電流大小。
通過如下電路測量相同電流下不同阻抗對應的GPIO電壓輸出(其中用到了一個電位器調節電流保持恆定):

通過計算後,下表是當輸出電流為2,4 … 16mA時,對應的阻抗大小以及如果發生短路時的短路電流大小。

可以看出短路電流都是超過16mA的。
一個發光二極管壓降約為1.5~2.0v,工作電流為3~10v
GPIO引腳的電流是通過板上的3.3V電壓調整器輸出的,樹莓派是按平均每個引腳3mA來設計的,所以總的電流不能超過17 * 3 = 51mA。
結論 :
需要注意的是Raspberry Pi 的GPIO :
1.有電流輸出的限制;每個接腳輸出最大為16mA,全部接腳同時最大輸出為51mA,所以通常會透過電流放大電路來驅動裝置, 不要直接驅動負載。
2.GPIO為3.3V準位加上沒有保護電路;千萬不要輸入5V電壓到接腳上,保護電路部分通常做法是接一個暫存器 (Register)或緩衝器(Buffer)來做緩衝。
3.GPIO不是即插即用的介面;除了要非常小心避免電路接錯外,在開啟Raspberry Pi 電源情況下不要隨意增加或修改電路。
2015-03-21
NOT BOOTING?!
碰到開機問題, 請首先仔細看一遍 "NOT BOOTING?! Read THIS BOOT PROBLEM STICKY (also for PI2B)".
而我的問題比較偏向 SD Crad controller 搭配問題, 類似:
1) Pi 2 is much more picky than B+ when it comes to memory cards and throws mmcblk0 errors randomly when rebooting #372
2) SDCard corruption on RPI2 #397.
2015-03-10
Setup Raspberry’s wireless network and assign a static IP address in Raspbian
1. paulv's comment in /etc/network/interfaces changed,weird 2 LAN IPs instead of 1
2. Setting a static IP on Raspberry Pi on Raspbian 20150505
----------------------------------------------------------------------------------------
Setup wireless network:
NEVER modify /etc/network/interfaces again.
add theses codes to /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="SSID"
psk="Your_wifi_password"
}
Set static IP address for an interface:
NEVER modify /etc/network/interfaces again.
Add these to /etc/dhcpcd.conf
interface eth0
static ip_address=192.168.0.200/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
Replace eth0 and the addresses as what you want.
Fixing Raspberrypi’s WiFi Dropout Issues on EDUP EP-N8508GS
If you find your wifi 'drops out' from time to time, you can fix it by following procedures:
Create and edit a new file in /etc/modprobe.d/8192cu.conf
sudo vi /etc/modprobe.d/8192cu.conf
# Disable power saving (recommended)
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
Then reboot with sudo reboot. 結果反應在 /sys/module/8192cu/parameters/…
For details, please check "A Brief Introduction to RTL8192C driver Power Saving"
# In associated idle
rtw_power_mgnt=0|1|2
0 == disable power saving
1 == power saving on, minPS
2 == power saving on, maxPS
rtw_enusbss=0|1
0 == disable auto suspend
1 == enable auto suspend
rtw_hwpwrp_detect=0|1
0 == disable HW power pin detection
1 == enable HW power pin detection
# Under unassociated idle state
rtw_ips_mode=0|1
0 == low power, IPS_NORMAL
1 == higher power, IPS_LEVEL2
The conventional wisdom, because we're running our RPis as server systems not clients, is to set rtw_power_mgnt=0 and rtw_enusbss=0 to prevent the dongle going into power saving and to ignore the other two parms because they don't make any difference. If the server goes into power saving we'd need a process to wake it up. That's different from a client system where interaction from a keyboard user will trigger a request to wake up and associate the dongle.