ืฆื’ HDMI ืฉื ื™ ืœ-Raspberry Pi3 ื‘ืืžืฆืขื•ืช ืžืžืฉืง DPI ื•ืœื•ื— FPGA


ืกืจื˜ื•ืŸ ื–ื” ืžืฆื™ื’: ืœื•ื— Raspberry Pi3, ื”ืžื—ื•ื‘ืจ ืืœื™ื• ื‘ืืžืฆืขื•ืช ืžื—ื‘ืจ GPIO ื”ื•ื ืœื•ื— FPGA Mars Rover2rpi (Cyclone IV), ืืœื™ื• ืžื—ื•ื‘ืจ ืฆื’ HDMI. ื”ืฆื’ ื”ืฉื ื™ ืžื—ื•ื‘ืจ ื“ืจืš ืžื—ื‘ืจ ื”-HDMI ื”ืกื˜ื ื“ืจื˜ื™ ืฉืœ ื”-Raspberry Pi3. ื”ื›ืœ ืขื•ื‘ื“ ื™ื—ื“ ื›ืžื• ืžืขืจื›ืช ืžื•ื ื™ื˜ื•ืจ ื›ืคื•ืœ.

ื”ื‘ื ืื ื™ ืืกืคืจ ืœืš ืื™ืš ื–ื” ืžื™ื•ืฉื.

ืœืœื•ื— Raspberry Pi3 ื”ืคื•ืคื•ืœืจื™ ื™ืฉ ืžื—ื‘ืจ GPIO ืฉื“ืจื›ื• ื ื™ืชืŸ ืœื—ื‘ืจ ื›ืจื˜ื™ืกื™ ื”ืจื—ื‘ื” ืฉื•ื ื™ื: ื—ื™ื™ืฉื ื™ื, ืœื“ื™ื, ื“ืจื™ื™ื‘ืจื™ื ืฉืœ ืžื ื•ืข ืฆืขื“ ื•ืขื•ื“. ื”ืชืคืงื•ื“ ื”ืžื“ื•ื™ืง ืฉืœ ื›ืœ ืคื™ืŸ ื‘ืžื—ื‘ืจ ืชืœื•ื™ ื‘ืชืฆื•ืจืช ื”ื™ืฆื™ืื”. ืชืฆื•ืจืช GPIO ALT2 ืžืืคืฉืจืช ืœืš ืœื”ืขื‘ื™ืจ ืืช ื”ืžื—ื‘ืจ ืœืžืฆื‘ ืžืžืฉืง DPI, Display Parallel Interface. ื™ืฉื ื ื›ืจื˜ื™ืกื™ ื”ืจื—ื‘ื” ืœื—ื™ื‘ื•ืจ ืžืกื›ื™ VGA ื“ืจืš DPI. ืขื ื–ืืช, ืจืืฉื™ืช, ืžืกื›ื™ VGA ื›ื‘ืจ ืื™ื ื ื ืคื•ืฆื™ื ื›ืžื• HDMI, ื•ืฉื ื™ืช, ื”ืžืžืฉืง ื”ื“ื™ื’ื™ื˜ืœื™ ื™ื•ืชืจ ื•ื™ื•ืชืจ ื˜ื•ื‘ ืžื”ืžืžืฉืง ื”ืื ืœื•ื’ื™. ื™ืชืจ ืขืœ ื›ืŸ, ื”-DAC ืขืœ ืœื•ื—ื•ืช ื”ืจื—ื‘ืช VGA ื›ืืœื” ืžื™ื•ืฆืจ ื‘ื“ืจืš ื›ืœืœ ื‘ืฆื•ืจื” ืฉืœ ืฉืจืฉืจืื•ืช R-2-R ื•ืœืขืชื™ื ืงืจื•ื‘ื•ืช ืœื ื™ื•ืชืจ ืž-6 ื‘ื™ื˜ื™ื ืœืฆื‘ืข.

ื‘ืžืฆื‘ ALT2, ืœืคื™ื ื™ ืžื—ื‘ืจื™ GPIO ื™ืฉ ืืช ื”ืžืฉืžืขื•ืช ื”ื‘ืื”:

ืฆื’ HDMI ืฉื ื™ ืœ-Raspberry Pi3 ื‘ืืžืฆืขื•ืช ืžืžืฉืง DPI ื•ืœื•ื— FPGA

ื›ืืŸ ืฆื‘ืขืชื™ ืืช ืคื™ื ื™ ื”-RGB ืฉืœ ื”ืžื—ื‘ืจ ื‘ืื“ื•ื, ื™ืจื•ืง ื•ื›ื—ื•ืœ ื‘ื”ืชืืžื”. ืื•ืชื•ืช ื—ืฉื•ื‘ื™ื ื ื•ืกืคื™ื ื”ื ื”ืื•ืชื•ืช V-SYNC ื•-H-SYNC, ื›ืžื• ื’ื CLK. ืชื“ืจ ื”ืฉืขื•ืŸ ืฉืœ CLK ื”ื•ื ื”ืชื“ืจ ืฉื‘ื• ืขืจื›ื™ ืคื™ืงืกืœื™ื ื™ื•ืฆืื™ื ืœืžื—ื‘ืจ; ื–ื” ืชืœื•ื™ ื‘ืžืฆื‘ ื”ื•ื•ื™ื“ืื• ืฉื ื‘ื—ืจ.

ื›ื“ื™ ืœื—ื‘ืจ ืฆื’ HDMI ื“ื™ื’ื™ื˜ืœื™, ืขืœื™ืš ืœืœื›ื•ื“ ืืช ืื•ืชื•ืช DPI ืฉืœ ื”ืžืžืฉืง ื•ืœื”ืžื™ืจ ืื•ืชื ืœืื•ืชื•ืช HDMI. ื–ื” ื™ื›ื•ืœ ืœื”ื™ืขืฉื•ืช, ืœืžืฉืœ, ื‘ืืžืฆืขื•ืช ืกื•ื’ ื›ืœืฉื”ื• ืฉืœ ืœื•ื— FPGA. ื›ืคื™ ืฉืžืชื‘ืจืจ, ืœื•ื— Mars Rover2rpi ืžืชืื™ื ืœืžื˜ืจื•ืช ืืœื•. ืœืžืขืŸ ื”ืืžืช, ื”ืืคืฉืจื•ืช ื”ืขื™ืงืจื™ืช ืœื—ื™ื‘ื•ืจ ืœื•ื— ื–ื” ื‘ืืžืฆืขื•ืช ืžืชืื ืžื™ื•ื—ื“ ื ืจืื™ืช ื›ืš:

ืฆื’ HDMI ืฉื ื™ ืœ-Raspberry Pi3 ื‘ืืžืฆืขื•ืช ืžืžืฉืง DPI ื•ืœื•ื— FPGA

ืœื•ื— ื–ื” ืžืฉืžืฉ ืœื”ื’ื“ืœืช ืžืกืคืจ ื™ืฆื™ืื•ืช GPIO ื•ืœื—ื™ื‘ื•ืจ ื”ืชืงื ื™ื ื”ื™ืงืคื™ื™ื ื ื•ืกืคื™ื ืœืคื˜ืœ. ื‘ืžืงื‘ื™ืœ, 4 ืื•ืชื•ืช GPIO ืขื ื—ื™ื‘ื•ืจ ื–ื” ืžืฉืžืฉื™ื ืœืื•ืชื•ืช JTAG, ื›ืš ืฉื”ืชื•ื›ื ื” ืž-Raspberry ื™ื›ื•ืœื” ืœื˜ืขื•ืŸ ืืช ืงื•ืฉื—ืช FPGA ืœ-FPGA. ื‘ื’ืœืœ ื–ื”, ื”ื—ื™ื‘ื•ืจ ื”ืกื˜ื ื“ืจื˜ื™ ื”ื–ื” ืœื ืžืชืื™ื ืœื™; 4 ืื•ืชื•ืช DPI ื ื•ืฉืจื™ื. ืœืžืจื‘ื” ื”ืžื–ืœ, ืœืžืกืจืงื™ื ื”ื ื•ืกืคื™ื ืขืœ ื”ืœื•ื— ื™ืฉ pinout ืชื•ืื ืคื˜ืœ. ืื– ืื ื™ ื™ื›ื•ืœ ืœืกื•ื‘ื‘ ืืช ื”ืœื•ื— 90 ืžืขืœื•ืช ื•ืขื“ื™ื™ืŸ ืœื—ื‘ืจ ืื•ืชื• ืœืคื˜ืœ ืฉืœื™:

ืฆื’ HDMI ืฉื ื™ ืœ-Raspberry Pi3 ื‘ืืžืฆืขื•ืช ืžืžืฉืง DPI ื•ืœื•ื— FPGA

ื›ืžื•ื‘ืŸ ืฉืชืฆื˜ืจื›ื• ืœื”ืฉืชืžืฉ ื‘ืžืชื›ื ืช JTAG ื—ื™ืฆื•ื ื™, ืื‘ืœ ื–ื• ืœื ื‘ืขื™ื”.

ืขื“ื™ื™ืŸ ื™ืฉ ื‘ืขื™ื” ืงื˜ื ื”. ืœื ื›ืœ ืคื™ืŸ FPGA ื™ื›ื•ืœ ืœืฉืžืฉ ื›ื›ื ื™ืกืช ืฉืขื•ืŸ. ื™ืฉื ืŸ ืจืง ื›ืžื” ืกื™ื›ื•ืช ื™ื™ืขื•ื“ื™ื•ืช ืฉื ื™ืชืŸ ืœื”ืฉืชืžืฉ ื‘ื”ืŸ ืœืžื˜ืจื•ืช ืืœื•. ืื– ื”ืชื‘ืจืจ ื›ืืŸ ืฉืื•ืช GPIO_0 CLK ืœื ืžื’ื™ืข ืœื›ื ื™ืกืช FPGA, ืฉื™ื›ื•ืœื” ืœืฉืžืฉ ื›ื›ื ื™ืกืช ืฉืขื•ืŸ FPGA. ืื– ืขื“ื™ื™ืŸ ื”ื™ื™ืชื™ ืฆืจื™ืš ืœืฉื™ื ื—ื•ื˜ ืื—ื“ ืขืœ ื”ืฆืขื™ืฃ. ืื ื™ ืžื—ื‘ืจ ืืช GPIO_0 ื•ืืช ืื•ืช KEY[1] ืฉืœ ื”ืœื•ื—:

ืฆื’ HDMI ืฉื ื™ ืœ-Raspberry Pi3 ื‘ืืžืฆืขื•ืช ืžืžืฉืง DPI ื•ืœื•ื— FPGA

ืขื›ืฉื™ื• ืื ื™ ืืกืคืจ ืœื›ื ืงืฆืช ืขืœ ืคืจื•ื™ืงื˜ FPGA. ื”ืงื•ืฉื™ ื”ืขื™ืงืจื™ ื‘ื™ืฆื™ืจืช ืื•ืชื•ืช HDMI ื”ื•ื ืชื“ืจื™ื ื’ื‘ื•ื”ื™ื ืžืื•ื“. ืื ืืชื” ืžืกืชื›ืœ ืขืœ ื”-pinout ืฉืœ ืžื—ื‘ืจ HDMI, ืืชื” ื™ื›ื•ืœ ืœืจืื•ืช ืฉืื•ืชื•ืช ื”-RGB ื”ื ื›ืขืช ืื•ืชื•ืช ื“ื™ืคืจื ืฆื™ืืœื™ื™ื ื˜ื•ืจื™ื™ื:

ืฆื’ HDMI ืฉื ื™ ืœ-Raspberry Pi3 ื‘ืืžืฆืขื•ืช ืžืžืฉืง DPI ื•ืœื•ื— FPGA

ื”ืฉื™ืžื•ืฉ ื‘ืื•ืช ื“ื™ืคืจื ืฆื™ืืœื™ ืžืืคืฉืจ ืœืš ืœื”ื™ืœื—ื ื‘ื”ืคืจืขื•ืช ื‘ืžืฆื‘ ื ืคื•ืฅ ื‘ืงื• ื”ืฉื™ื“ื•ืจ. ื‘ืžืงืจื” ื–ื”, ืงื•ื“ ืฉืžื•ื ื” ื”ืกื™ื‘ื™ื•ืช ื”ืžืงื•ืจื™ ืฉืœ ื›ืœ ืื•ืช ืฆื‘ืข ืžื•ืžืจ ืœ-TMDS ืฉืœ 10 ืกื™ื‘ื™ื•ืช (Transition-minimaled differential signaling). ื–ื•ื”ื™ ืฉื™ื˜ืช ืงื™ื“ื•ื“ ืžื™ื•ื—ื“ืช ืœื”ืกื™ืจ ืืช ืจื›ื™ื‘ ื”-DC ืžื”ืื•ืช ื•ืœืžื–ืขืจ ืืช ืžื™ืชื•ื’ ื”ืื•ืช ื‘ืงื• ื“ื™ืคืจื ืฆื™ืืœื™. ืžื›ื™ื•ื•ืŸ ืฉื›ืขืช ืฆืจื™ืš ืœื”ืขื‘ื™ืจ 10 ื‘ื™ื˜ื™ื ืขืœ ื”ืงื• ื”ื˜ื•ืจื™ ืขื‘ื•ืจ ื‘ื™ื™ื˜ ืื—ื“ ืฉืœ ืฆื‘ืข, ืžืกืชื‘ืจ ืฉืžื”ื™ืจื•ืช ื”ืฉืขื•ืŸ ืฉืœ ื”ืกื“ืจืช ื—ื™ื™ื‘ืช ืœื”ื™ื•ืช ื’ื‘ื•ื”ื” ืคื™ 10 ืžืžื”ื™ืจื•ืช ื”ืฉืขื•ืŸ ื”ืคื™ืงืกืœื™ื. ืื ื ื™ืงื— ืœื“ื•ื’ืžื ืืช ืžืฆื‘ ื”ื•ื•ื™ื“ืื• 1280x720 60Hz, ืื– ืชื“ืจ ื”ืคื™ืงืกืœื™ื ืฉืœ ืžืฆื‘ ื–ื” ื”ื•ื 74,25 ืžื’ื”-ื”ืจืฅ. ื”- Serializer ืฆืจื™ืš ืœื”ื™ื•ืช 742,5 ืžื’ื”-ื”ืจืฅ.

FPGAs ืจื’ื™ืœื™ื, ืœืžืจื‘ื” ื”ืฆืขืจ, ืื™ื ื ืžืกื•ื’ืœื™ื ืœื›ืš. ืขื ื–ืืช, ืœืžื–ืœื ื•, ืœ-FPGA ื™ืฉ ืคื™ื ื™ DDIO ืžื•ื‘ื ื™ื. ืืœื• ืžืกืงื ื•ืช ืฉื”ืŸ ื›ื‘ืจ, ื›ื‘ื™ื›ื•ืœ, 2-to-1 ืกื“ืจื”. ื›ืœื•ืžืจ, ื”ื ื™ื›ื•ืœื™ื ืœื”ื•ืฆื™ื ืฉื ื™ ื‘ื™ื˜ื™ื ื‘ืจืฆืฃ ืขืœ ื”ืงืฆื•ื•ืช ื”ืขื•ืœื™ื ื•ื™ื•ืจื“ื™ื ืฉืœ ืชื“ืจ ื”ืฉืขื•ืŸ. ื–ื” ืื•ืžืจ ืฉื‘ืคืจื•ื™ืงื˜ FPGA ืืชื” ื™ื›ื•ืœ ืœื”ืฉืชืžืฉ ืœื ื‘-740 ืžื’ื”-ื”ืจืฅ, ืืœื ื‘-370 ืžื’ื”-ื”ืจืฅ, ืื‘ืœ ืืชื” ืฆืจื™ืš ืœื”ืฉืชืžืฉ ื‘ืจื›ื™ื‘ื™ ืคืœื˜ DDIO ื‘-FPGA. ื›ืขืช 370 ืžื’ื”-ื”ืจืฅ ื”ื•ื ื›ื‘ืจ ืชื“ืจ ื‘ืจ-ื”ืฉื’ื” ืœื—ืœื•ื˜ื™ืŸ. ืœืžืจื‘ื” ื”ืฆืขืจ, ืžืฆื‘ 1280x720 ื”ื•ื ื”ื’ื‘ื•ืœ. ืœื ื ื™ืชืŸ ืœื”ืฉื™ื’ ืจื–ื•ืœื•ืฆื™ื” ื’ื‘ื•ื”ื” ื™ื•ืชืจ ื‘-Cyclone IV FPGA ืฉืœื ื• ื”ืžื•ืชืงืŸ ืขืœ ืœื•ื— Mars Rover2rpi.

ืื–, ื‘ืชื›ื ื•ืŸ, ืชื“ืจ ื”ืคื™ืงืกืœื™ื ื”ืงืœื˜ CLK ืขื•ื‘ืจ ืœ-PLL, ืฉื ื”ื•ื ืžื•ื›ืคืœ ื‘-5. ื‘ืชื“ืจ ื–ื”, ื”-R, G, B ืžื•ืžืจื™ื ืœื–ื•ื’ื•ืช ืกื™ื‘ื™ื•ืช. ื–ื” ืžื” ืฉืžืงื•ื“ื“ ื”-TMDS ืขื•ืฉื”. ืงื•ื“ ื”ืžืงื•ืจ ื‘-Verilog HDL ื ืจืื” ื›ืš:

module hdmi(
	input wire pixclk,		// 74MHz
	input wire clk_TMDS2,	// 370MHz
	input wire hsync,
	input wire vsync,
	input wire active,
	input wire [7:0]red,
	input wire [7:0]green,
	input wire [7:0]blue,
	output wire TMDS_bh,
	output wire TMDS_bl,
	output wire TMDS_gh,
	output wire TMDS_gl,
	output wire TMDS_rh,
	output wire TMDS_rl
);

wire [9:0] TMDS_red, TMDS_green, TMDS_blue;
TMDS_encoder encode_R(.clk(pixclk), .VD(red  ), .CD({vsync,hsync}), .VDE(active), .TMDS(TMDS_red));
TMDS_encoder encode_G(.clk(pixclk), .VD(green), .CD({vsync,hsync}), .VDE(active), .TMDS(TMDS_green));
TMDS_encoder encode_B(.clk(pixclk), .VD(blue ), .CD({vsync,hsync}), .VDE(active), .TMDS(TMDS_blue));

reg [2:0] TMDS_mod5=0;  // modulus 5 counter
reg [4:0] TMDS_shift_bh=0, TMDS_shift_bl=0;
reg [4:0] TMDS_shift_gh=0, TMDS_shift_gl=0;
reg [4:0] TMDS_shift_rh=0, TMDS_shift_rl=0;

wire [4:0] TMDS_blue_l  = {TMDS_blue[9],TMDS_blue[7],TMDS_blue[5],TMDS_blue[3],TMDS_blue[1]};
wire [4:0] TMDS_blue_h  = {TMDS_blue[8],TMDS_blue[6],TMDS_blue[4],TMDS_blue[2],TMDS_blue[0]};
wire [4:0] TMDS_green_l = {TMDS_green[9],TMDS_green[7],TMDS_green[5],TMDS_green[3],TMDS_green[1]};
wire [4:0] TMDS_green_h = {TMDS_green[8],TMDS_green[6],TMDS_green[4],TMDS_green[2],TMDS_green[0]};
wire [4:0] TMDS_red_l   = {TMDS_red[9],TMDS_red[7],TMDS_red[5],TMDS_red[3],TMDS_red[1]};
wire [4:0] TMDS_red_h   = {TMDS_red[8],TMDS_red[6],TMDS_red[4],TMDS_red[2],TMDS_red[0]};

always @(posedge clk_TMDS2)
begin
	TMDS_shift_bh <= TMDS_mod5[2] ? TMDS_blue_h  : TMDS_shift_bh  [4:1];
	TMDS_shift_bl <= TMDS_mod5[2] ? TMDS_blue_l  : TMDS_shift_bl  [4:1];
	TMDS_shift_gh <= TMDS_mod5[2] ? TMDS_green_h : TMDS_shift_gh  [4:1];
	TMDS_shift_gl <= TMDS_mod5[2] ? TMDS_green_l : TMDS_shift_gl  [4:1];
	TMDS_shift_rh <= TMDS_mod5[2] ? TMDS_red_h   : TMDS_shift_rh  [4:1];
	TMDS_shift_rl <= TMDS_mod5[2] ? TMDS_red_l   : TMDS_shift_rl  [4:1];
	TMDS_mod5 <= (TMDS_mod5[2]) ? 3'd0 : TMDS_mod5+3'd1;
end

assign TMDS_bh = TMDS_shift_bh[0];
assign TMDS_bl = TMDS_shift_bl[0];
assign TMDS_gh = TMDS_shift_gh[0];
assign TMDS_gl = TMDS_shift_gl[0];
assign TMDS_rh = TMDS_shift_rh[0];
assign TMDS_rl = TMDS_shift_rl[0];

endmodule

module TMDS_encoder(
	input clk,
	input [7:0] VD,	// video data (red, green or blue)
	input [1:0] CD,	// control data
	input VDE,  	// video data enable, to choose between CD (when VDE=0) and VD (when VDE=1)
	output reg [9:0] TMDS = 0
);

wire [3:0] Nb1s = VD[0] + VD[1] + VD[2] + VD[3] + VD[4] + VD[5] + VD[6] + VD[7];
wire XNOR = (Nb1s>4'd4) || (Nb1s==4'd4 && VD[0]==1'b0);
wire [8:0] q_m = {~XNOR, q_m[6:0] ^ VD[7:1] ^ {7{XNOR}}, VD[0]};

reg [3:0] balance_acc = 0;
wire [3:0] balance = q_m[0] + q_m[1] + q_m[2] + q_m[3] + q_m[4] + q_m[5] + q_m[6] + q_m[7] - 4'd4;
wire balance_sign_eq = (balance[3] == balance_acc[3]);
wire invert_q_m = (balance==0 || balance_acc==0) ? ~q_m[8] : balance_sign_eq;
wire [3:0] balance_acc_inc = balance - ({q_m[8] ^ ~balance_sign_eq} & ~(balance==0 || balance_acc==0));
wire [3:0] balance_acc_new = invert_q_m ? balance_acc-balance_acc_inc : balance_acc+balance_acc_inc;
wire [9:0] TMDS_data = {invert_q_m, q_m[8], q_m[7:0] ^ {8{invert_q_m}}};
wire [9:0] TMDS_code = CD[1] ? (CD[0] ? 10'b1010101011 : 10'b0101010100) : (CD[0] ? 10'b0010101011 : 10'b1101010100);

always @(posedge clk) TMDS <= VDE ? TMDS_data : TMDS_code;
always @(posedge clk) balance_acc <= VDE ? balance_acc_new : 4'h0;

endmodule

ืœืื—ืจ ืžื›ืŸ ืฆืžื“ื™ ื”ืžื•ืฆื ืžื•ื–ื ื™ื ืœื™ืฆื™ืืช DDIO, ืืฉืจ ืžื™ื™ืฆืจืช ื‘ืจืฆืฃ ืื•ืช ืฉืœ ืกื™ื‘ื™ื•ืช ืื—ืช ื‘ืงืฆื•ื•ืช ื”ืขื•ืœื™ื ื•ื™ื•ืจื“ื™ื.

ื ื™ืชืŸ ืœืชืืจ ืืช DDIO ืขืฆืžื• ืขื ืงื•ื“ Verilog ื”ื‘ื:

module ddio(
	input wire d0,
	input wire d1,
	input wire clk,
	output wire out
	);

reg r_d0;
reg r_d1;
always @(posedge clk)
begin
	r_d0 <= d0;
	r_d1 <= d1;
end
assign out = clk ? r_d0 : r_d1;
endmodule

ืื‘ืœ ืกื‘ื™ืจ ืœื”ื ื™ื— ืฉื–ื” ืœื ื™ืขื‘ื•ื“ ื›ื›ื”. ืขืœื™ืš ืœื”ืฉืชืžืฉ ื‘ืžื’ื”-ืคื•ื ืงืฆื™ื™ืช ALTDDIO_OUT ืฉืœ Alter ื›ื“ื™ ืœืืคืฉืจ ืœืžืขืฉื” ืืช ืจื›ื™ื‘ื™ ื”ืคืœื˜ ืฉืœ DDIO. ื”ืคืจื•ื™ืงื˜ ืฉืœื™ ืžืฉืชืžืฉ ื‘ืจื›ื™ื‘ ื”ืกืคืจื™ื™ื” ALTDDIO_OUT.

ื›ืœ ื–ื” ืื•ืœื™ ื ืจืื” ืงืฆืช ืžืกื•ื‘ืš, ืื‘ืœ ื–ื” ืขื•ื‘ื“.

ืืชื” ื™ื›ื•ืœ ืœื”ืฆื™ื’ ืืช ื›ืœ ืงื•ื“ ื”ืžืงื•ืจ ืฉื ื›ืชื‘ ื‘-Verilog HDL ื›ืืŸ ื‘-github.

ื”ืงื•ืฉื—ื” ื”ืžื”ื•ื“ืจืช ืขื‘ื•ืจ ื”-FPGA ืžื•ื‘ื–ืงืช ืœืชื•ืš ืฉื‘ื‘ EPCS ื”ืžื•ืชืงืŸ ืขืœ ืœื•ื— Mars Rover2rpi. ืœืคื™ื›ืš, ื›ืืฉืจ ืžื•ืคืขืœ ืžืชื— ืขืœ ืœื•ื— ื”-FPGA, ื”-FPGA ื™ืื•ืชื—ืœ ืžื–ื™ื›ืจื•ืŸ ื”ื‘ื–ืง ื•ื™ืชื—ื™ืœ.

ืขื›ืฉื™ื• ืื ื—ื ื• ืฆืจื™ื›ื™ื ืœื“ื‘ืจ ืงืฆืช ืขืœ ื”ืชืฆื•ืจื” ืฉืœ ื”ืคื˜ืœ ืขืฆืžื•.

ืื ื™ ืขื•ืฉื” ื ื™ืกื•ื™ื™ื ื‘-Raspberry PI OS (32 ืกื™ื‘ื™ื•ืช) ื”ืžื‘ื•ืกืกื™ื ืขืœ ื“ื‘ื™ืืŸ ื‘ืืกื˜ืจ, ื’ืจืกื”: ืื•ื’ื•ืกื˜ 2020,
ืชืืจื™ืš ืคืจืกื•ื: 2020-08-20, ื’ืจืกืช ืœื™ื‘ื”: 5.4.

ืืชื” ืฆืจื™ืš ืœืขืฉื•ืช ืฉื ื™ ื“ื‘ืจื™ื:

  • ืขืจื•ืš ืืช ืงื•ื‘ืฅ config.txt;
  • ืฆื•ืจ ืชืฆื•ืจืช ืฉืจืช X ืœืขื‘ื•ื“ื” ืขื ืฉื ื™ ืฆื’ื™ื.

ื‘ืขืช ืขืจื™ื›ืช ืงื•ื‘ืฅ /boot/config.txt ืืชื” ืฆืจื™ืš:

  1. ื”ืฉื‘ืช ืืช ื”ืฉื™ืžื•ืฉ ื‘-i2c, i2s, spi;
  2. ืืคืฉืจ ืžืฆื‘ DPI ื‘ืืžืฆืขื•ืช ืฉื›ื‘ืช-ืขืœ dtoverlay=dpi24;
  3. ื”ื’ื“ืจ ืžืฆื‘ ื•ื™ื“ืื• 1280ร—720 60Hz, 24 ืกื™ื‘ื™ื•ืช ืœืคื™ืงืกืœ ื‘-DPI;
  4. ืฆื™ื™ืŸ ืืช ื”ืžืกืคืจ ื”ื ื“ืจืฉ ืฉืœ framebuffers 2 (max_framebuffers=2, ืจืง ืื– ื™ื•ืคื™ืข ื”ืžื›ืฉื™ืจ ื”ืฉื ื™ /dev/fb1)

ื”ื˜ืงืกื˜ ื”ืžืœื ืฉืœ ืงื•ื‘ืฅ config.txt ื ืจืื” ื›ืš.

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

dtparam=i2c_arm=off
dtparam=spi=off
dtparam=i2s=off

dtoverlay=dpi24
overscan_left=0
overscan_right=0
overscan_top=0
overscan_bottom=0
framebuffer_width=1280
framebuffer_height=720
display_default_lcd=0
enable_dpi_lcd=1
dpi_group=2
dpi_mode=87
#dpi_group=1
#dpi_mode=4
dpi_output_format=0x6f027
dpi_timings=1280 1 110 40 220 720 1 5 5 20 0 0 0 60 0 74000000 3

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
#dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d
max_framebuffers=2

ืœืื—ืจ ืžื›ืŸ, ืขืœื™ืš ืœื™ืฆื•ืจ ืงื•ื‘ืฅ ืชืฆื•ืจื” ืขื‘ื•ืจ ืฉืจืช X ื›ื“ื™ ืœื”ืฉืชืžืฉ ื‘ืฉื ื™ ืฆื’ื™ื ืขืœ ืฉื ื™ ืžืืคื™ ืžืกื’ืจืช /dev/fb0 ื•-/dev/fb1:

ืงื•ื‘ืฅ ื”ืชืฆื•ืจื” ืฉืœื™ /usr/share/x11/xorg.conf.d/60-dualscreen.conf ื”ื•ื ื›ื–ื”

Section "Device"
        Identifier      "LCD"
        Driver          "fbturbo"
        Option          "fbdev" "/dev/fb0"
        Option          "ShadowFB" "off"
        Option          "SwapbuffersWait" "true"
EndSection

Section "Device"
        Identifier      "HDMI"
        Driver          "fbturbo"
        Option          "fbdev" "/dev/fb1"
        Option          "ShadowFB" "off"
        Option          "SwapbuffersWait" "true"
EndSection

Section "Monitor"
        Identifier      "LCD-monitor"
        Option          "Primary" "true"
EndSection

Section "Monitor"
        Identifier      "HDMI-monitor"
        Option          "RightOf" "LCD-monitor"
EndSection

Section "Screen"
        Identifier      "screen0"
        Device          "LCD"
        Monitor         "LCD-monitor"
EndSection

Section "Screen"
        Identifier      "screen1"
        Device          "HDMI" 
	Monitor         "HDMI-monitor"
EndSection

Section "ServerLayout"
        Identifier      "default"
        Option          "Xinerama" "on"
        Option          "Clone" "off"
        Screen 0        "screen0"
        Screen 1        "screen1" RightOf "screen0"
EndSection

ื•ื‘ื›ืŸ, ืื ื–ื” ืขื“ื™ื™ืŸ ืœื ืžื•ืชืงืŸ, ืื– ืืชื” ืฆืจื™ืš ืœื”ืชืงื™ืŸ ืืช Xinerama. ืื– ืฉื˜ื— ืฉื•ืœื—ืŸ ื”ืขื‘ื•ื“ื” ื™ื•ืจื—ื‘ ื‘ืžืœื•ืื• ืœืฉื ื™ ืžืกื›ื™ื, ื›ืคื™ ืฉืžื•ืฆื’ ื‘ืกืจื˜ื•ืŸ ื”ื”ื“ื’ืžื” ืœืžืขืœื”.

ื–ื” ื›ื ืจืื” ื”ื›ืœ. ื›ืขืช, ื‘ืขืœื™ Raspberry Pi3 ื™ื•ื›ืœื• ืœื”ืฉืชืžืฉ ื‘ืฉื ื™ ืžืกื›ื™ื.

ื ื™ืชืŸ ืœืžืฆื•ื ืชื™ืื•ืจ ื•ื“ื™ืื’ืจืžืช ืžืขื’ืœื™ื ืฉืœ ืœื•ื— Mars Rover2rpi ืชืกืชื›ืœ ื›ืืŸ.

ืžืงื•ืจ: www.habr.com