硬件接线
LED- ------- PICO-GND
LED+ ------- PICO-3.3V
RESX ------- PICO-PIN27
DCX ------- PICO-PIN26
SCL ------- PICO-PIN14
SDA ------- PICO-PIN15
VDDI ------- PICO-3.3V
VDD ------- PICO-3.3V
CSX ------- PICO-PIN12
未被复用的GPIO2_A2和A3用来做DCX和RESX,一个切换,一个是重置
内核、设备树配置
make ARCH=arm menuconfig
设备树增加spi节点的配置,同时设备树的位置luckfox-pico/sysdrv/source/kernel/arch/arm/boot/dts/rv1106g-luckfox-pico-pro-max.dts,
如下为改动的地方:
/ {
model = "Luckfox Pico Max";
compatible = "rockchip,rv1103g-38x38-ipc-v10", "rockchip,rv1106";
/*LCD DC*/
gpio2pa2:gpio2pa2 {
compatible = "regulator-fixed";
pinctrl-names = "default";
pinctrl-0 = <&gpio2_pa2>;
regulator-name = "gpio2_pa2";
regulator-always-on;
};
/*LCD RESET*/
gpio2pa3:gpio2pa3 {
compatible = "regulator-fixed";
pinctrl-names = "default";
pinctrl-0 = <&gpio2_pa3>;
regulator-name = "gpio2_pa3";
regulator-always-on;
};
};
&pinctrl {
/*LCD DC*/
gpio2-pa2 {
gpio2_pa2:gpio2-pa2 {
rockchip,pins = <2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
/*LCD RESET*/
gpio2-pa3 {
gpio2_pa3:gpio2-pa3 {
rockchip,pins = <2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
};
// /**********SPI**********/
&spi0 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi0m0_pins &spi0m0_cs0>;
//cs-gpios = <&gpio1 RK_PC0 1>;
// cs-gpios = <&gpio1 26 1>;
#address-cells = <1>;
#size-cells = <0>;
//spidev@0 {
// compatible = "rockchip,spidev";
// spi-max-frequency = <50000000>;
// reg = <0>;
//};
st7735r@0{
compatible = "sitronix,st7735r";
reg = <0>;
status = "okay";
spi-max-frequency = <48000000>;
dc = <&gpio2 RK_PA2 1>;
reset = <&gpio2 RK_PA3 1>;
rotation = <90>;
spi-cpol;
spi-cpha;
fps = <30>;
buswidth = <8>;
rgb;
};
};
更新boot.img,使用dmesg进行查看framebuffer设备是否启用
测试
使用ffmpeg输出bad apple到屏幕上
sudo ffmpeg -v 60 -i rotate-video-4.mp4 -pix_fmt rgb565le -f fbdev /dev/fb0
视频讲解