Orange Pi

Orange Pi

www.orangepi.org

From Orange Pi

Jump to: navigation, search

Save and exit, re-compile the kernel:

make uImage

Replace the earlier uImage on the board with the new generated uImage under arch/arm/boot/ directory.

Config the script.fex

The A20 supports two channel video output, however, only LCD0 is available on Orange Pi, therefore, we connect the 7inch capacitive LCD to the LCD0 controller.
Config the script.fex, [dis_init] setting for display device initialization, and [lcd0_para] setting for LCD parameters (depending on the specifications of concrete LCD), as follows:

[disp_init] 
disp_init_enable = 1 
disp_mode = 0 
screen0_output_type = 1 
screen0_output_mode = 4 
screen1_output_type = 0 
screen1_output_mode = 4 
fb0_width = 1024 
fb0_height = 768 
fb0_framebuffer_num = 2 
fb0_format = 10 
fb0_pixel_sequence = 0 
fb0_scaler_mode_enable = 0 
fb1_width = 1024 
fb1_height = 768 
fb1_framebuffer_num = 2 
fb1_format = 10 
fb1_pixel_sequence = 0 
fb1_scaler_mode_enable = 0 
lcd0_backlight = 197 
lcd1_backlight = 197 
lcd0_bright = 50 
lcd0_contrast = 50 
lcd0_saturation = 57 
lcd0_hue = 50 
lcd1_bright = 50  
lcd1_contrast = 50 
lcd1_saturation = 57 
lcd1_hue = 50
[lcd0_para] 
lcd_used = 1 
lcd_x = 800  
lcd_y = 480 
lcd_dclk_freq = 33 
lcd_pwm_not_used = 0 
lcd_pwm_ch = 0 
lcd_pwm_freq = 10000 
lcd_pwm_pol = 0 
lcd_max_bright = 240 
lcd_min_bright = 64 
lcd_if = 0 
lcd_hbp = 215 
lcd_ht = 1055 
lcd_vbp = 34 
lcd_vt = 1050 
lcd_vspw = 3 
lcd_hspw = 20 
lcd_hv_if = 0 
lcd_hv_smode = 0 
lcd_hv_s888_if = 0 
lcd_hv_syuv_if = 0 
lcd_lvds_ch = 0 
lcd_lvds_mode = 0 
lcd_lvds_bitwidth = 0 
lcd_lvds_io_cross = 0 
lcd_cpu_if = 0 
lcd_frm = 1 
lcd_io_cfg0 = 0 
lcd_gamma_correction_en = 0 
lcd_gamma_tbl_0 = 0x0 
lcd_gamma_tbl_1 = 0x10101 
lcd_gamma_tbl_255 = 0xffffff 
lcd_bl_en_used = 1 
lcd_bl_en = port:PH07<1><0><default><1> 
lcd_power_used = 1 
lcd_power = port:PH08<1><0><default><1> 
lcd_pwm_used = 1 
lcd_pwm = port:PB02<2><0><default><default> 
lcd_gpio_0 = 
lcd_gpio_1 = 
lcd_gpio_2 = 
lcd_gpio_3 = 
lcdd0 = port:PD00<2><0><default><default> 
lcdd1 = port:PD01<2><0><default><default> 
lcdd2 = port:PD02<2><0><default><default> 
lcdd3 = port:PD03<2><0><default><default> 
lcdd4 = port:PD04<2><0><default><default> 
lcdd5 = port:PD05<2><0><default><default> 
lcdd6 = port:PD06<2><0><default><default> 
lcdd7 = port:PD07<2><0><default><default> 
lcdd8 = port:PD08<2><0><default><default> 
lcdd9 = port:PD09<2><0><default><default> 
lcdd10 = port:PD10<2><0><default><default> 
lcdd11 = port:PD11<2><0><default><default> 
lcdd12 = port:PD12<2><0><default><default> 
lcdd13 = port:PD13<2><0><default><default> 
lcdd14 = port:PD14<2><0><default><default> 
lcdd15 = port:PD15<2><0><default><default> 
lcdd16 = port:PD16<2><0><default><default> 
lcdd17 = port:PD17<2><0><default><default> 
lcdd18 = port:PD18<2><0><default><default> 
lcdd19 = port:PD19<2><0><default><default> 
lcdd20 = port:PD20<2><0><default><default> 
lcdd21 = port:PD21<2><0><default><default> 
lcdd22 = port:PD22<2><0><default><default> 
lcdd23 = port:PD23<2><0><default><default> 
lcdclk = port:PD24<2><0><default><default> 
lcdde = port:PD25<2><0><default><default> 
lcdhsync = port:PD26<2><0><default><default> 
lcdvsync = port:PD27<2><0><default><default>

Then convert it into script.bin format by using fex2bin, and replace the earlier script.bin on the board.
Reboot the Orange Pi system, the LCD should be ready to work.

Porting HDMI Driver

HDMI driver has been includes in the kernel, just config the script.fex directly:

[disp_init] 
disp_init_enable = 1 
disp_mode = 0 
screen0_output_type = 3 
screen0_output_mode = 4 
screen1_output_type = 0 
screen1_output_mode = 4 
fb0_width = 1024 
fb0_height = 768 
fb0_framebuffer_num = 2 
fb0_format = 10 
fb0_pixel_sequence = 0 
fb0_scaler_mode_enable = 0 
fb1_width = 1024 
fb1_height = 768 
fb1_framebuffer_num = 2 
fb1_format = 10 
fb1_pixel_sequence = 0 
fb1_scaler_mode_enable = 0 
lcd0_backlight = 197 
lcd1_backlight = 197 
lcd0_bright = 50 
lcd0_contrast = 50 
lcd0_saturation = 57 
lcd0_hue = 50 
lcd1_bright = 50 
lcd1_contrast = 50 
lcd1_saturation = 57 
lcd1_hue = 50

Then convert it into script.bin format by using fex2bin, and replace the earlier script.bin on the board.
Reboot the system, now the HDMI can be used for displaying.

Porting AV driver

AV driver has been included in the kernel, just config the script.fex directly:

[disp_init] 
disp_init_enable = 1 
disp_mode = 0 
screen0_output_type = 2 
screen0_output_mode = 11 
screen1_output_type = 0 
screen1_output_mode = 4 
fb0_width = 1024 
fb0_height = 768 
fb0_framebuffer_num = 2 
fb0_format = 10 
fb0_pixel_sequence = 0 
fb0_scaler_mode_enable = 0 
fb1_width = 1024 
fb1_height = 768 
fb1_framebuffer_num = 2 
fb1_format = 10 
fb1_pixel_sequence = 0 
fb1_scaler_mode_enable = 0 
lcd0_backlight = 197 
lcd1_backlight = 197 
lcd0_bright = 50 
lcd0_contrast = 50 
lcd0_saturation = 57 
lcd0_hue = 50 
lcd1_bright = 50 
lcd1_contrast = 50 
lcd1_saturation = 57 
lcd1_hue = 50

Then convert it into script.bin format by using fex2bin, and replace the earlier script.bin on the board.
Reboot the system, now the AV port can be used for displaying.

Porting CSI Driver

Config the Kernel

make menuconfig
Device Drivers  ---> 
   <*> Multimedia support  ---> 
      <*>   Video For Linux 
      [*]   CSI Driver Config for sun4i  ---> 
          <M>   OmniVision OV5460 sensor support

Built the camera driver as module, save and exit.
Comment out the print messages in the s32 img_sw_para_to_reg(u8 type, u8 mode, u8 value) function in disp_layer.c file, which is under drivers/video/sunxi/disp directory.
Lines 95 to 99:

/*      else { 
            DE_WRN("not supported yuv channel format:%d in " 
                    "img_sw_para_to_regn", value); 
            return 0; 
         }*/

Lines 125 to 129:

/*      else { 
         DE_WRN("not supported yuv channel pixel sequence:%d " 
                    "in img_sw_para_to_regn", value); 
            return 0; 
         }*/

Lines 168 to 172:

/*      else { 
          DE_WRN("not supported image0 pixel sequence:%d in " 
                    "img_sw_para_to_regn", value); 
            return 0; 
         }*/

Line 175:

//  DE_WRN("not supported type:%d in img_sw_para_to_regn", type);

Save, re-compile the kernel:

make uImage

Compile the kernel modules:

make modules

Install the kernel modules:

make modules_install

The installation copies the compiled kernel module from the kernel source code to the ubuntu /lib/modules directory.
The related driver module files include: videobuf-core.ko, videobuf-dma-contig.ko, sun4i_csi0.ko, ov7670.ko, which are located respectively in:

videobuf-core.ko, videobuf-dma-contig.ko: 
/lib/modules/3.4.XX/kernel/drivers/media/video 

ov5640.ko: 
/lib/modules/3.4.XX/kernel/drivers/media/video/sun4i_csi/device 

sun4i_csi0.ko: 
/lib/modules/3.4.XX/kernel/drivers/media/video/sun4i_csi/csi0 

Replace the earlier uImage on Orange Pi with the new generated uImage under arch/arm/boot/ directory.
Copy the above 4 driver files to the board, and install them in order:

insmod  videobuf-core.ko 
insmod  videobuf-dma-contig.ko 
insmod  ov5640.ko 
insmod  sun4i_csi0.ko

Note: please pay attention to the installing order, camera driver should be installed before sun4i_csi0.ko.

Config the script.fex

Since our OV5460 camera is connected to the CSI0 controller, config the [csi0_para] and [camera_list_para] setting in script.fex. The suffix _b in the parameter name indicates that this is a secondary camera parameter while two cameras were connected to the same CSI port.

The details configuration of CSI0:

[csi0_para] 
csi_used = 1 
csi_dev_qty = 1 
csi_stby_mode = 0 
csi_mname = "ov5460" 
csi_if = 0 
csi_iovdd = "axp20_pll" 
csi_avdd = "" 
csi_dvdd = "" 
csi_vol_iovdd = 2800 
csi_vol_dvdd = 
csi_vol_avdd = 
csi_vflip = 1 
csi_hflip = 0 
csi_flash_pol = 1 
csi_facing = 1 
csi_twi_id = 1 
csi_twi_addr = 0x78 
csi_pck = port:PE00<3><default><default><default> 
csi_ck = port:PE01<3><default><default><default> 
csi_hsync = port:PE02<3><default><default><default> 
csi_vsync = port:PE03<3><default><default><default> 
csi_d0 = port:PE04<3><default><default><default> 
csi_d1 = port:PE05<3><default><default><default> 
csi_d2 = port:PE06<3><default><default><default> 
csi_d3 = port:PE07<3><default><default><default> 
csi_d4 = port:PE08<3><default><default><default> 
csi_d5 = port:PE09<3><default><default><default> 
csi_d6 = port:PE10<3><default><default><default> 
csi_d7 = port:PE11<3><default><default><default> 
csi_reset = port:PH14<1><default><default><0> 
csi_power_en = port:PH16<1><default><default><0> 
csi_stby = port:PH19<1><default><default><0>
[camera_list_para] 
camera_list_para_used = 1 
ov7670 = 0 
gc0308 = 0 
gt2005 = 0 
hi704 = 0 
sp0838 = 0 
mt9m112 = 0 
mt9m113 = 0 
ov2655 = 0 
hi253 = 0 
gc0307 = 0 
mt9d112 = 0 
ov5640 = 1 
gc2015 = 0 
ov2643 = 0 
gc0329 = 0 
gc0309 = 0 
tvp5150 = 0 
s5k4ec = 0 
ov5650_mv9335 = 0 
siv121d = 0 
gc2035 = 0


Then convert it into script.bin format by using fex2bin, and replace the earlier script.bin on the board.
Connect the OV5640 camera module to Orange Pi, reboot Orange Pi.
Now you can start to try the camera .

Porting USB OTG Driver

Config the Kernel

Config the kernel to include the OTG driver:

make menuconfig
Device Drivers  ---> 
   [*]USB support  ---> 
       [*]SUNXI USB2.0 Dual Role Controller support 
            [*]SUNXI USB2.0 Manager             
                 USB0 Controller support (otg support) ---> 
                      (X)otg_suppot 

Save and exit. Re-compile the kernel:

make uImage

Replace the earlier uImage on Orange Pi with the new generated uImage under arch/arm/boot/ directory.

Config the script.fex

Config the script.fex as follows, modify the [usbc0] setting as follow:

[usbc0] 
usb_used = 1 
usb_port_type = 2 
usb_detect_type = 1 
usb_id_gpio = port:PH04<0><1><default><default> 
usb_det_vbus_gpio = port:PH05<0><0><default><default> 
usb_drv_vbus_gpio = port:PB09<1><0><default><0> 
usb_restric_gpio = port:PH00<1><0><default><0> 
usb_host_init_state = 0 
usb_restric_flag = 0 
usb_restric_voltage = 3550000 
usb_restric_capacity = 5

Then convert it into script.bin format by using fex2bin, and replace the earlier script.bin on Orange Pi.

Reboot the Orange Pi system, and connect the OTG cable to the USB OTG port.

Reference

1. Fex_Guide
2. http://docs.cubieboard.org/tutorials/dvk521/documentations/a20/driver_porting_and_configuration

Source www.orangepi.org

Report Page