二月 27, 2013

解决Raspberry Pi只能在默认640×480模式下显示的问题

Written by

购买Raspberry Pi V2后,还得为他配置其他一些周边器件,如5V2A的micro usb电源线、显示器、键盘、鼠标等。手头上有N多VGA显示器,却没一台DVI的,没办法,淘宝上买了专门针对树莓派生产的电源(18RMB)和hdmi转vga线(70RMB)。

按照网上的一些说法,先通过SSH登录进去,把/boot/config.txt里的几个参数放出:

hdmi_safe=1
disable_overscan=1

overscan_left=-30
overscan_right=-30
overscan_top=-30
overscan_bottom=-30

hdmi_force_hotplug=1

hdmi_group=2
hdmi_mode=16

hdmi_drive=2

config_hdmi_boost=4

注意,必须把hdmi_drive设为2,因为1是DVI输出,2才是hdmi输出,因为我的线是hdmi转vga的。

这样,重新启动Pi后,基本能显示了,可是默认是640×480的,看着非常别扭,网上找了很多资料,包括把如下config.txt部分放开:

framebuffer_width=1280
framebuffer_height=960

貌似分辨率成了1280×960,而实际上是,只是Pi按1280×960输出到屏幕上了,而屏幕的分辨率还是640×480的,所以字体很虚很模糊,几乎看不清。

按理说只要更改

hdmi_group=2   —>1:CEA  2:DMT
hdmi_mode=4   —>从模式列表中选取一种显示模式

就可以切换显示分辨率了,可是怎么改都没啥用。貌似不起任何作用!

幸好看了完整的Raspberry Pi配置说明,发现当hdmi_safe设置为1时,hdmi_group默认为1,hdmi_mode为1,后面你怎么改hdmi_group和hdmi_mode都不起作用了!!!


## hdmi_safe
##     Use "safe mode" settings to try to boot with maximum hdmi compatibility.
##
##     Value    Description
##     -------------------------------------------------------------------------
##     0        Disabled (Default)
##     1        Enabled (this does: hdmi_force_hotplug=1, config_hdmi_boost=4,
##                                  hdmi_group=1, hdmi_mode=1,
##                                  disable_overscan=0)
##
#hdmi_safe=1

注意看完整的Raspberry Pi配置说明,你会发现,当disable_overscan=1时,overscan_top、overscan_botom、overscan_left、overscan_right几个参数不起作用!

################################################################################
##  Overscan Video Settings
################################################################################

## overscan_left
##     Number of pixels to skip on left
##
#overscan_left=0

## overscan_right
##     Number of pixels to skip on right
##
#overscan_right=0

## overscan_top
##     Number of pixels to skip on top
##
#overscan_top=0

## overscan_bottom
##     Number of pixels to skip on bottom
##
#overscan_bottom=0

## disable_overscan
##     Set to 1 to disable overscan
##
##     Value    Description
##     -------------------------------------------------------------------------
##     0        Overscan Enabled (Default)
##     1        Overscan Disabled
##
#disable_overscan=1

所以,最后我的配置文件是这样的:

pi@raspberrypi:/boot$ vi config.txt 
#hdmi_edid_file=1

# 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=-30
#overscan_right=-30
#overscan_top=-30
#overscan_bottom=-30

# 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=32

# 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

# for more options see http://elinux.org/RPi_config.txt

绝对完美运行。

一个对hdmi_safe=1的不了解,折腾了我这么多天,真是不值啊。

后面写的就不用看了,都是以前走的弯路,那个弯啊,绕啊,希望你们就别走了……

===========================================================

用tvservice -d edid.dat将edid数据导出到edid.dat:

pi@raspberrypi:/opt/vc/bin$ tvservice -d edid.dat
Written 0 bytes to edid.dat

没数据。。。

使用tvservice -s查看当前的显示状态

pi@raspberrypi:~$ tvservice -s
state: HPD high|HDMI mode|HDCP off|composite off (0x12001a), 640x480 @ 60Hz, progressive

的确是640×480 @ 60 Hz显示的。再用-m查看支持的显示,却发现只有一种CEA模式,而DMT模式根本就没有:

pi@raspberrypi:~$ tvservice -m CEA
Group CEA has 1 modes:
           mode 1: 640x480 @ 60Hz, progressive
pi@raspberrypi:~$ tvservice -m DMT
Group DMT has 0 modes:

这就难怪怎么改config.txt中的hdmi_group和hdmi_mode都没用的原因了!!!

网上翻了很多资料,终于发现,只要在config.txt文件开头加入如下信息,重启,终于以更高的分辨率显示了:

hdmi_edid_file=1

hdmi_edid_file默认为0,表示从设备读取edid信息,如果为1,则强制从edid.txt文件读取edid信息。

启动后,进入终端,查看当前状态:

pi@raspberrypi:~$ tvservice -s
state: HPD high|HDMI mode|HDCP off|composite off (0x12001a), 1280x720 @ 60Hz, progressive

可见现在的显示模式是 1280×720 @ 60Hz。

现在hdmi是如下配置的:

hdmi_group=1
hdmi_mode=16

貌似这个值不起作用了。

很疑惑,这个edid.txt文件在哪里???如果不存在,是否可以通过导入一个edit.txt文件来达到配置显示分辨率的目的呢?

 

附:

从这里http://elinux.org/RPiconfig可以看到group和mode的对应关系,相应的修改即可:

These values are valid if hdmi_group=1 (CEA)
hdmi_mode=1    VGA
hdmi_mode=2    480p  60Hz
hdmi_mode=3    480p  60Hz  H
hdmi_mode=4    720p  60Hz
hdmi_mode=5    1080i 60Hz
hdmi_mode=6    480i  60Hz
hdmi_mode=7    480i  60Hz  H
hdmi_mode=8    240p  60Hz
hdmi_mode=9    240p  60Hz  H
hdmi_mode=10   480i  60Hz  4x
hdmi_mode=11   480i  60Hz  4x H
hdmi_mode=12   240p  60Hz  4x
hdmi_mode=13   240p  60Hz  4x H
hdmi_mode=14   480p  60Hz  2x
hdmi_mode=15   480p  60Hz  2x H
hdmi_mode=16   1080p 60Hz
hdmi_mode=17   576p  50Hz
hdmi_mode=18   576p  50Hz  H
hdmi_mode=19   720p  50Hz
hdmi_mode=20   1080i 50Hz
hdmi_mode=21   576i  50Hz
hdmi_mode=22   576i  50Hz  H
hdmi_mode=23   288p  50Hz
hdmi_mode=24   288p  50Hz  H
hdmi_mode=25   576i  50Hz  4x
hdmi_mode=26   576i  50Hz  4x H
hdmi_mode=27   288p  50Hz  4x
hdmi_mode=28   288p  50Hz  4x H
hdmi_mode=29   576p  50Hz  2x
hdmi_mode=30   576p  50Hz  2x H
hdmi_mode=31   1080p 50Hz
hdmi_mode=32   1080p 24Hz
hdmi_mode=33   1080p 25Hz
hdmi_mode=34   1080p 30Hz
hdmi_mode=35   480p  60Hz  4x
hdmi_mode=36   480p  60Hz  4xH
hdmi_mode=37   576p  50Hz  4x
hdmi_mode=38   576p  50Hz  4x H
hdmi_mode=39   1080i 50Hz  reduced blanking
hdmi_mode=40   1080i 100Hz
hdmi_mode=41   720p  100Hz
hdmi_mode=42   576p  100Hz
hdmi_mode=43   576p  100Hz H
hdmi_mode=44   576i  100Hz
hdmi_mode=45   576i  100Hz H
hdmi_mode=46   1080i 120Hz
hdmi_mode=47   720p  120Hz
hdmi_mode=48   480p  120Hz
hdmi_mode=49   480p  120Hz H
hdmi_mode=50   480i  120Hz
hdmi_mode=51   480i  120Hz H
hdmi_mode=52   576p  200Hz
hdmi_mode=53   576p  200Hz H
hdmi_mode=54   576i  200Hz
hdmi_mode=55   576i  200Hz H
hdmi_mode=56   480p  240Hz
hdmi_mode=57   480p  240Hz H
hdmi_mode=58   480i  240Hz
hdmi_mode=59   480i  240Hz H
H means 16:9 variant (of a normally 4:3 mode).
2x means pixel doubled (i.e. higher clock rate, with each pixel repeated twice)
4x means pixel quadrupled (i.e. higher clock rate, with each pixel repeated four times)

 

These values are valid if hdmi_group=2 (DMT)
hdmi_mode=1    640x350   85Hz
hdmi_mode=2    640x400   85Hz
hdmi_mode=3    720x400   85Hz
hdmi_mode=4    640x480   60Hz
hdmi_mode=5    640x480   72Hz
hdmi_mode=6    640x480   75Hz
hdmi_mode=7    640x480   85Hz
hdmi_mode=8    800x600   56Hz
hdmi_mode=9    800x600   60Hz
hdmi_mode=10   800x600   72Hz
hdmi_mode=11   800x600   75Hz
hdmi_mode=12   800x600   85Hz
hdmi_mode=13   800x600   120Hz
hdmi_mode=14   848x480   60Hz
hdmi_mode=15   1024x768  43Hz  DO NOT USE
hdmi_mode=16   1024x768  60Hz
hdmi_mode=17   1024x768  70Hz
hdmi_mode=18   1024x768  75Hz
hdmi_mode=19   1024x768  85Hz
hdmi_mode=20   1024x768  120Hz
hdmi_mode=21   1152x864  75Hz
hdmi_mode=22   1280x768        reduced blanking
hdmi_mode=23   1280x768  60Hz
hdmi_mode=24   1280x768  75Hz
hdmi_mode=25   1280x768  85Hz
hdmi_mode=26   1280x768  120Hz reduced blanking
hdmi_mode=27   1280x800        reduced blanking
hdmi_mode=28   1280x800  60Hz
hdmi_mode=29   1280x800  75Hz
hdmi_mode=30   1280x800  85Hz
hdmi_mode=31   1280x800  120Hz reduced blanking
hdmi_mode=32   1280x960  60Hz
hdmi_mode=33   1280x960  85Hz
hdmi_mode=34   1280x960  120Hz reduced blanking
hdmi_mode=35   1280x1024 60Hz
hdmi_mode=36   1280x1024 75Hz
hdmi_mode=37   1280x1024 85Hz
hdmi_mode=38   1280x1024 120Hz reduced blanking
hdmi_mode=39   1360x768  60Hz
hdmi_mode=40   1360x768  120Hz reduced blanking
hdmi_mode=41   1400x1050       reduced blanking
hdmi_mode=42   1400x1050 60Hz
hdmi_mode=43   1400x1050 75Hz
hdmi_mode=44   1400x1050 85Hz
hdmi_mode=45   1400x1050 120Hz reduced blanking
hdmi_mode=46   1440x900        reduced blanking
hdmi_mode=47   1440x900  60Hz
hdmi_mode=48   1440x900  75Hz
hdmi_mode=49   1440x900  85Hz
hdmi_mode=50   1440x900  120Hz reduced blanking
hdmi_mode=51   1600x1200 60Hz
hdmi_mode=52   1600x1200 65Hz
hdmi_mode=53   1600x1200 70Hz
hdmi_mode=54   1600x1200 75Hz
hdmi_mode=55   1600x1200 85Hz
hdmi_mode=56   1600x1200 120Hz reduced blanking
hdmi_mode=57   1680x1050       reduced blanking
hdmi_mode=58   1680x1050 60Hz
hdmi_mode=59   1680x1050 75Hz
hdmi_mode=60   1680x1050 85Hz
hdmi_mode=61   1680x1050 120Hz reduced blanking
hdmi_mode=62   1792x1344 60Hz
hdmi_mode=63   1792x1344 75Hz
hdmi_mode=64   1792x1344 120Hz reduced blanking
hdmi_mode=65   1856x1392 60Hz
hdmi_mode=66   1856x1392 75Hz
hdmi_mode=67   1856x1392 120Hz reduced blanking
hdmi_mode=68   1920x1200       reduced blanking
hdmi_mode=69   1920x1200 60Hz
hdmi_mode=70   1920x1200 75Hz
hdmi_mode=71   1920x1200 85Hz
hdmi_mode=72   1920x1200 120Hz reduced blanking
hdmi_mode=73   1920x1440 60Hz
hdmi_mode=74   1920x1440 75Hz
hdmi_mode=75   1920x1440 120Hz reduced blanking
hdmi_mode=76   2560x1600       reduced blanking
hdmi_mode=77   2560x1600 60Hz
hdmi_mode=78   2560x1600 75Hz
hdmi_mode=79   2560x1600 85Hz
hdmi_mode=80   2560x1600 120Hz reduced blanking
hdmi_mode=81   1366x768  60Hz
hdmi_mode=82   1080p     60Hz
hdmi_mode=83   1600x900        reduced blanking
hdmi_mode=84   2048x1152       reduced blanking
hdmi_mode=85   720p      60Hz
hdmi_mode=86   1366x768        reduced blanking

 

Category : Linux/Unix

Tags :

Comments

One Response

  1. PaulineZ说道:

    找了一下午,终于在看到楼主这篇Blog的时候成功了,跪谢T-T

发表评论

电子邮件地址不会被公开。

Proudly powered by WordPress and Sweet Tech Theme