登录 注册
当前位置:主页 > 资源下载 > 18 > spi_csdn_tinav2.1验证通过_SPI0接口配置流行屏_20171106_1958没有外层目录.7z下载

spi_csdn_tinav2.1验证通过_SPI0接口配置流行屏_20171106_1958没有外层目录.7z下载

  • 更新:2024-08-31 17:52:56
  • 大小:1.46MB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:Android - 移动开发
  • 格式:7Z

资源介绍

开发板使用:CB-A(需要外接+5V) 1、在lichee中初始化RGB屏幕:KD027QVTPD022 W:\liuxing_****_tinav2.1\lichee\linux-3.4\drivers\video\sunxi\lcd\panels\default_panel.c static void LCD_panel_init(u32 sel) { u32 i; //printk("raoyiming +++ LCD_panel_init\n"); /**/ panel_rst(1); sunxi_lcd_delay_ms(1); panel_rst(0); sunxi_lcd_delay_ms(10); panel_rst(1); sunxi_lcd_delay_ms(120); return; } W:\liuxing_****_tinav2.1\lichee\linux-3.4\drivers\video\sunxi\lcd\panels\default_panel.h #define panel_rst(v) (sunxi_lcd_gpio_set_value(0, 0, v)) 第二个0是sys_config.fex中lcd_gpio_0 lcd_gpio_0 = port:PH07<1><0><0> 2、 W:\liuxing_****_tinav2.1\target\allwinner\astar-parrot\configs\sys_config.fex 生成的SPI的设备名: ;---------------------------------------------------------------------------------- ;[spi_board0] spi device configuration ;modalias = spi device name ;sflash_size = spi flash size, optional, if spi_board0 is nor flash , carefully ;max_speed_hz = max transfer speed ;bus_num = bus ID ;chip_select = chip select, 0,1 ;mode = SPI transfer mode ;---------------------------------------------------------------------------------- [spi_board0] ;modalias = "at25df641" modalias = "spidev" sflash_size = 32 max_speed_hz = 50000000 bus_num = 0 chip_select = 0 mode = 0 加入RGB的屏幕参数(如果希望调优请找模组厂协助): ;---------------------------------------------------------------------------------- ;lcd0 configuration ;lcd_if: 0:hv(sync+de); 1:8080; 2:ttl; 3:lvds; 4:dsi; 5:edp; 6:extend dsi ;lcd_x: lcd horizontal resolution ;lcd_y: lcd vertical resolution ;lcd_width: width of lcd in mm ;lcd_height: height of lcd in mm ;lcd_dclk_freq: in MHZ unit ;lcd_pwm_freq: in HZ unit ;lcd_pwm_pol: lcd backlight PWM polarity ;lcd_pwm_max_limit lcd backlight PWM max limit(<=255) ;lcd_hbp: hsync back porch ;lcd_ht: hsync total cycle ;lcd_vbp: vsync back porch ;lcd_vt: vysnc total cycle ;lcd_hspw: hsync plus width ;lcd_vspw: vysnc plus width ;lcd_lvds_if: 0:single link; 1:dual link ;lcd_lvds_colordepth: 0:8bit; 1:6bit ;lcd_lvds_mode: 0:NS mode; 1:JEIDA mode ;lcd_frm: 0:disable; 1:enable rgb666 dither; 2:enable rgb656 dither ;lcd_io_phase: 0:noraml; 1:intert phase(0~3bit: vsync phase; 4~7bit:hsync phase; ; 8~11bit:dclk phase; 12~15bit:de phase) ;lcd_gamma_en lcd gamma correction enable ;lcd_bright_curve_en lcd bright curve correction enable ;lcd_cmap_en lcd color map function enable ;deu_mode 0:smoll lcd screen; 1:large lcd screen(larger than 10inch) ;lcdgamma4iep: Smart Backlight parameter, lcd gamma vale * 10; ; decrease it while lcd is not bright enough; increase while lcd is too bright ;smart_color 90:normal lcd screen 65:retina lcd screen(9.7inch) ;---------------------------------------------------------------------------------- [lcd0_para] lcd_used = 1 lcd_driver_name = "default_lcd" lcd_if = 0 lcd_x = 320 lcd_y = 240 lcd_width = 0 lcd_height = 0 lcd_dclk_freq = 5 lcd_pwm_used = 1 lcd_pwm_ch = 0 lcd_pwm_freq = 50000 lcd_pwm_pol = 1 lcd_hbp = 60 lcd_ht = 390 lcd_hspw = 6 lcd_vbp = 6 lcd_vt = 250 lcd_vspw = 2 lcd_lvds_if = 0 lcd_lvds_colordepth = 0 lcd_lvds_mode = 0 lcd_frm = 1 lcd_gamma_en = 0 lcd_bright_curve_en = 0 lcd_cmap_en = 0 deu_mode = 0 lcdgamma4iep = 22 smart_color = 90 lcd_bl_en = port:PD13<1><0><1> lcd_power = "axp22_dc1sw" lcd_gpio_0 = port:PH07<1><0><0> lcd_gpio_1 = port:PL04<1><0><0> lcd_gpio_2 = port:PL11<1><0><1> ;lcdd0 = port:PD00<2><0><2> ;lcdd1 = port:PD01<2><0><2> lcdd2 = port:PD02<2><0><2> lcdd3 = port:PD03<2><0><2> lcdd4 = port:PD04<2><0><2> lcdd5 = port:PD05<2><0><2> lcdd6 = port:PD06<2><0><2> lcdd7 = port:PD07<2><0><2> ;lcdd8 = port:PD08<2><0><2> ;lcdd9 = port:PD09<2><0><2> lcdd10 = port:PD10<2><0><2> lcdd11 = port:PD11<2><0><2> lcdd12 = port:PD12<2><0><2> lcdd13 = port:PD13<2><0><2> lcdd14 = port:PD14<2><0><2> lcdd15 = port:PD15<2><0><2> ;lcdd16 = port:PD16<2><0><2> ;lcdd17 = port:PD17<2><0><2> lcdd18 = port:PD18<2><0><2> lcdd19 = port:PD19<2><0><2> lcdd20 = port:PD20<2><0><2> lcdd21 = port:PD21<2><0><2> lcdd22 = port:PD22<2><0><2> lcdd23 = port:PD23<2><0><2> lcdclk = port:PD24<2><0><3> lcdde = port:PD25<2><0><2> lcdhsync = port:PD26<2><0><2> lcdvsync = port:PD27<2><0><2> 3、原理:生成设备节点:/dev/spidev0.0。然后通用C格式的应用程序访问这个设备节点来初始化LCD。 编译刷机之后: 开机之后背光是亮的(背光被强制拉高了) root@TinaLinux:/# root@TinaLinux:/# find . -name spi* ./bin/spidev_test0 ./dev/spidev0.0 ./proc/irq/97/spi0 ./rom/bin/spidev_test0 ./rom/usr/lib/opkg/info/spidev_test0.control ./rom/usr/lib/opkg/info/spidev_test0.list ./sys/bus/spi ./sys/bus/spi/devices/spi0.0 ./sys/bus/spi/drivers/spidev ./sys/bus/spi/drivers/spidev/spi0.0 ./sys/bus/platform/devices/spi.0 ./sys/bus/platform/drivers/spi ./sys/bus/platform/drivers/spi/spi.0 ./sys/devices/platform/spi.0 ./sys/devices/platform/spi.0/spi_master ./sys/devices/platform/spi.0/spi_master/spi0 ./sys/devices/platform/spi.0/spi_master/spi0/spi0.0 ./sys/devices/platform/spi.0/spi_master/spi0/spi0.0/spidev ./sys/devices/platform/spi.0/spi_master/spi0/spi0.0/spidev/spidev0.0 ./sys/class/spi_master ./sys/class/spi_master/spi0 ./sys/class/spidev ./sys/class/spidev/spidev0.0 ./sys/kernel/debug/clk/hosc/pll_periph/pll_periphahb1/ahb1/spinlock ./sys/kernel/debug/clk/hosc/pll_periph/spi0 ./sys/kernel/debug/clk/hosc/spi1 ./sys/module/spidev ./usr/lib/opkg/info/spidev_test0.control ./usr/lib/opkg/info/spidev_test0.list root@TinaLinux:/# root@TinaLinux:/# (初始化屏幕之后是全绿:) root@TinaLinux:/# spidev_test0 spi mode: 0 bits per word: 8 max speed: 500000 Hz (500 KHz) send spi message success! root@TinaLinux:/# root@TinaLinux:/# (红绿蓝单色和一张静态图片的切换) root@TinaLinux:/# root@TinaLinux:/# root@TinaLinux:/# cb_test [ 203.906264] request_suspend_state: wakeup (0->0) at 203906241807 (1970-01-01 08:41:09.853073511 UTC) fb0 begining readCnt = 1 ****wyb 2017/7/3 9:36 x = 320 y = 240 bytes_per_pixel = 4 screensize = 307200 ----- RED 0 ----- GREEN ----- BLUE ----- RED 1 ----- GREEN ----- BLUE ^C root@TinaLinux:/# (绿红黑等单色循环测试) root@TinaLinux:/# root@TinaLinux:/# root@TinaLinux:/# fbtest **** wyb fbtest.c-391-main argc=1 **** wyb fbtest.c-453-main argc2=1 **** wyb fbtest.c-462-main opening framebuffer device success! **** wyb fbtest.c-471-main getting fix screeninfo success! **** wyb fbtest.c-480-main getting var screeninfo success! **** wyb fbtest.c-489-main setting mode success! **** wyb fbtest.c-498-main mmap'ing framebuffer device success! testing: ARGB for sizes: 320x240 ^C root@TinaLinux:/# root@TinaLinux:/# 4、改进方向: W:\liuxing_****_tinav2.1\lichee\linux-3.4\drivers\video\sunxi\lcd\panels\default_panel.c 在驱动中增加SPI初始化部分,然后还可以让开机自动进入红绿蓝的测试程序!