orangepi lite 运行环境armbian focal,
配置设备树
sun8i-h3-orangepi-lite.dts 配置文件
/dts-v1/;
#include "sun8i-h3.dtsi"
#include "sunxi-common-regulators.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
model = "Xunlong Orange Pi Lite";
compatible = "xunlong,orangepi-lite", "allwinner,sun8i-h3";
aliases {
/* The H3 emac is not used so the wifi is ethernet0 */
ethernet0 = &rtl8189ftv;
serial0 = &uart0;
};
chosen {
stdout-path = "serial0:115200n8";
};
connector {
compatible = "hdmi-connector";
type = "a";
port {
hdmi_con_in: endpoint {
remote-endpoint = <&hdmi_out_con>;
};
};
};
leds {
compatible = "gpio-leds";
pwr_led {
label = "orangepi:green:pwr";
gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
status_led {
label = "orangepi:red:status";
gpios = <&pio 0 15 GPIO_ACTIVE_HIGH>;
};
};
r_gpio_keys {
compatible = "gpio-keys";
sw4 {
label = "sw4";
linux,code = <BTN_0>;
gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
};
};
reg_vdd_1v5_csi: vdd-1v5-csi {
compatible = "regulator-fixed";
regulator-name = "vdd1v5-csi";
regulator-min-microvolt = <1500000>;
regulator-max-microvolt = <1500000>;
gpio = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
enable-active-high;
regulator-boot-on;
regulator-always-on;
};
reg_vcc_csi: vcc-csi {
compatible = "regulator-fixed";
regulator-name = "vcc-csi";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
gpio = <&pio 0 17 GPIO_ACTIVE_HIGH>; /* PA17 */
enable-active-high;
regulator-boot-on;
regulator-always-on;
};
reg_vcc_af_csi: vcc-af-csi {
compatible = "regulator-fixed";
regulator-name = "vcc-af-csi";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
gpio = <&pio 6 13 GPIO_ACTIVE_HIGH>; /* PG13 */
enable-active-high;
regulator-boot-on;
regulator-always-on;
};
/*
/omit-if-no-ref/
csi_mclk_pin: csi-mclk-pin {
pins = "PE1";
function = "csi";
};
*/
};
&de {
status = "okay";
};
&ehci1 {
status = "okay";
};
&ehci2 {
status = "okay";
};
&hdmi {
status = "okay";
};
&hdmi_out {
hdmi_out_con: endpoint {
remote-endpoint = <&hdmi_con_in>;
};
};
&ir {
pinctrl-names = "default";
pinctrl-0 = <&r_ir_rx_pin>;
status = "okay";
};
&mmc0 {
vmmc-supply = <®_vcc3v3>;
bus-width = <4>;
cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
status = "okay";
};
&mmc1 {
vmmc-supply = <®_vcc3v3>;
bus-width = <4>;
non-removable;
status = "okay";
/*
* Explicitly define the sdio device, so that we can add an ethernet
* alias for it (which e.g. makes u-boot set a mac-address).
*/
rtl8189ftv: sdio_wifi@1 {
reg = <1>;
};
};
&ohci1 {
status = "okay";
};
&ohci2 {
status = "okay";
};
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pa_pins>;
status = "okay";
};
&usbphy {
/* USB VBUS is always on */
status = "okay";
};
&ccu {
/* Use a stable clock source with known fixed rate for MCLK */
assigned-clocks = <&ccu CLK_CSI_MCLK>;
assigned-clock-parents = <&osc24M>;
assigned-clock-rates = <24000000>;
};
&csi {
status = "okay";
port {
#address-cells = <1>;
#size-cells = <0>;
/* Parallel bus endpoint */
csi_ep: endpoint {
remote-endpoint = <&ov5640_ep>;
bus-width = <8>;
hsync-active = <1>; /* Active high */
vsync-active = <0>; /* Active low */
data-active = <1>; /* Active high */
pclk-sample = <1>; /* Rising */
};
};
};
&i2c2_pins {
bias-pull-up;
};
&i2c2 {
status = "okay";
ov5640: camera@3c {
compatible = "ovti,ov5640";
reg = <0x3c>;
/*
pinctrl-names = "default";
pinctrl-0 = <&csi_mclk_pin>;*/
clocks = <&ccu CLK_CSI_MCLK>;
clock-names = "xclk";
AVDD-supply = <®_vcc_af_csi>;
DOVDD-supply = <®_vdd_1v5_csi>;
DVDD-supply = <®_vcc_csi>;
reset-gpios = <&pio 4 14 GPIO_ACTIVE_LOW>; /* CSI-RST-R: PE14 */
powerdown-gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>; /* CSI-STBY-R: PE15 */
port {
ov5640_ep: endpoint {
remote-endpoint = <&csi_ep>;
bus-width = <8>;
data-shift = <2>; /* lines 9:2 are used */
hsync-active = <1>; /* Active high */
vsync-active = <0>; /* Active low */
data-active = <1>; /* Active high */
pclk-sample = <1>; /* Rising */
};
};
};
};
sunxi-h3-h5.dtsi csi_pins:csi-pins 内添加 “PE1”
csi_pins: csi-pins {
pins = "PE0", "PE2", "PE3", "PE4", "PE5",
"PE6", "PE7", "PE8", "PE9", "PE10",
"PE11","PE1";
function = "csi";
};
运行测试
配置好设备树,重启后,
root@orangepilite:~# v4l2-ctl --list-devices
sun6i-csi (platform:camera):
/dev/video0
cedrus (platform:cedrus):
/dev/video2
/dev/media0
Allwinner Video Capture Device (platform:sun6i-csi):
/dev/media1
sun8i-di (platform:sun8i-di):
/dev/video1
使用fswebcam 保持图片
fswebcam -d /dev/video0 -r 640x480 --fps 30 -p UYVY -S 30 1.jpg
修改输出的格式为 1920×1080
media-ctl --device /dev/media1 --set-v4l2 '"ov5640 1-003c":0[fmt:UYVY/1920x1080]'
fswebcam -d /dev/video1 -r 1920x1080 -D 3 --jpeg 100 1.jpg
参考
https://forum.armbian.com/topic/13238-ov5640-device-tree-overlay-for-orangepi-one-h3/
版权声明:本文为yytyu2017原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。