树莓派驱动DLPDLCR230NPEVM+framebuffer显示图片

DLPDLCR230NPEVM

        DLP® LightCrafter™ Display 230NP 是一个易于使用的紧凑型即插即用评估平台,适用于消费类产品、工业、医疗和物联网 (IoT) 市场中的各种超便携显示应用。此评估模块 (EVM) 采用 DLP230NP 芯片组,该芯片组由 DLP230NP .23 1080p DMD、DLPC3436 显示控制器和 DLPA2005 PMIC/LED 驱动器组成。此 EVM 外形小巧,配备生产就绪型光学引擎以及支持 18 位 RGB 并行视频接口的处理器接口。了解 DLPDLCR2000EVM 这款更经济实用的 EVM,它具有 nHD 分辨率、20lm 和 Beagle Bone Black 开箱即可兼容等特性。(摘自TI官网DLPDLCR230NPEVM 评估板 | TI.com.cn)。

特性

  • 81mm x 87mm 紧凑外形(EVM 的尺寸类似于名片)
  • 帮助开发人员评估高性能 DLP 显示技术的实惠之选
  • 支持高达 100 流明的即插即用型 DLP 1080p 光学引擎
  • I²C 和 18 位并行 RGB 视频接口,几乎可支持任何低成本主机处理器
  • Raspberry PI 4 开箱即可兼容

 基于与树莓派4开箱即可兼容的特点,特购买此投影仪。     

目的:树莓派驱动投影仪像被测物体投影光栅图片

步骤

树莓派跟投影仪之间联通可参考TI官网下载的用户手册。

1.首先,树莓派与投影仪之间想要正确驱动,需要修改树莓派的config.txt文件。

 可通过以下代码方式修改,也可通过取出树莓派SD卡,修改config.txt文件。

sudo nano /boot/config.txt
sudo reboot

   完整的config.txt如下。

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

# #########################################
# DO NOT MODIFY THE LINES BELOW THIS POINT
# #########################################

# 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=2
#hdmi_mode=82

# 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

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

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

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

# #########################################
# DO NOT MODIFY THE LINES ABOVE THIS POINT
# #########################################

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

# Configure Raspberry PI for SSH over USB
dtoverlay=dwc2

# Configure I2C on GPIO Pins #22 and #23
dtoverlay=i2c-gpio,bus=7,i2c-gpio_sda=23,i2c_gpio_scl=22,i2c_gpio_delay_us=2

# Configure DPI on GPIO Pins #0 through #21
gpio=0=op
gpio=0=pn
gpio=1-27=ip
gpio=1-27=pn


# Enable DPI18 Overlay
enable_dpi_lcd=1
display_default_lcd=1
dpi_group=2
dpi_mode=87

# Configure DPI Video Timings
# RGB 666 CFG 1 (MODE 5)
dpi_output_format=458773 

# 58 Hz Timings (Low-End Spec)
# Works at GPIO DRIVE 5-7
hdmi_timings=1920 0 20 10 10 1080 0 10 10 10 0 0 0 58 0 125000000 3

# NOTE: GPIO PINS #24 - #27 ARE DRIVEN SEPARATELY BY WiringPi SOFTWARE

[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
start_x=1
gpu_mem=128

按照官网上给的sample config和python support code 不能正常驱动,根据python驱动代码,在config文件中配置I2C和GPIO这一行中添加上bus=7,问题解决,能够正常驱动。

修改此config文件后是不能正常驱动hdmi屏幕的)                        

 2.将投影仪和树莓派通过40针的排线连接,两者都接通电源。

 3.提前将官网python support package下载到树莓派。(文件如下图所示)

4.终端控制树莓派 ,运行到下载python support package的文件夹下,运行init_parallel_mode.py程序投影仪就可以投影树莓派的桌面了。(此时投影仪相当于一个HDMI屏幕)

5.由于后续开发不想用gui界面,所以想采取纯终端的方式。(在树莓派中输入 sudo raspi-config,进入system options,在进入s5 boot/auto login ,选择B2 console Auto login,重启就可以了,步骤如下)。此过程可在所有步骤之前设置

6.而在终端下,显示图片就不像GUI界面那样方便,所以想到了framebuffer。

       帧缓冲(framebuffer)是Linux为显示设备提供的一个接口,把显存抽象后的一种设备,他允许上层应用程序在图形模式下直接对显示缓冲区进行 读写操作。framebuffer是LCD对应的一中HAL(硬件抽象层),提供抽象的,统一的接口操作,用户不必关心硬件层是怎么实施的。这些都是由 Framebuffer设备驱动来完成的。 
        帧缓冲设备对应的设备文件为/dev/fb*,如果系统有多个显示卡,Linux下还可支持多个帧缓冲设备,最多可达32个,分别为/dev/fb0到 /dev/fb31,而/dev/fb则为当前缺省的帧缓冲设备,通常指向/dev/fb0,在嵌入式系统中支持一个显示设备就够了。帧缓冲设备为标准字 符设备,主设备号为29,次设备号则从0到31。分别对应/dev/fb0-/dev/fb31。

        帧缓冲驱动的应用广泛,在linux的桌面系统中,Xwindow服务器就是利用帧缓冲进行窗口的绘制。尤其是通过帧缓冲可显示汉字点阵,成为Linux汉化的唯一可行方案。 

       Linux FrameBuffer 本质上只是提供了对图形设备的硬件抽象,在开发者看来,FrameBuffer 是一块显示缓存,往显示缓存中写入特定格式的数据就意味着向屏幕输出内容。所以说FrameBuffer就是一块白板。例如对于初始化为16 位色的FrameBuffer 来说, FrameBuffer中的两个字节代表屏幕上一个点,从上到下,从左至右,屏幕位置与内存地址是顺序的线性关系。
        帧缓存可以在系统存储器(内存)的任意位置,视频控制器通过访问帧缓存来刷新屏幕。 帧缓存也叫刷新缓存 Frame buffer 或 refresh buffer, 这里的帧(frame)是指整个屏幕范围。  
       帧缓存有个地址,是在内存里。我们通过不停的向frame buffer中写入数据, 显示控制器就自动的从frame buffer中取数据并显示出来。全部的图形都共享内存中同一个帧缓存。

framebuffer内容可参考 (16条消息) FrameBuffer_yaoyutian的博客-CSDN博客_framebuffer

然后运行代码(如下)就可以用framebuffer 显示图片了。

sudo apt-get install fbi

sudo fbi -d /dev/fb0 -T 1 -noverbose -a fringe.bmp

 树莓派中只有一个framebuffer,位置是 /dev/fb0,fringe.bmp是我存在当前路径下的一张图片。

(转载请注明出处)

  • 6
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值