XO 4 HDMI Debug

From OLPC
Revision as of 03:54, 29 October 2012 by Wad (talk | contribs)
Jump to: navigation, search

Some notes for testing the HDMI Interface of the XO-4 laptop.

Setup

Start with an [XO_4_B1|XO-4 laptop]] running the latest firmware ( Q7B04 ). It should have a second serial port connected. You will want to download the following two pieces of software and place them on a USB stick:

Install the zImage file as /boot/vmlinuz using the following OFW command:

ok copy u:\zImhdmi int:\boot\vmlinuz

Type y when it asks if it is OK to overwrite the existing file.

Boot Linux. Then mount the USB key and install hdmi_ctl into the local directory:

mount /dev/sda1 /mnt
cp /mnt/hdmi_ctl .
chmod a+x hdmi_ctl

Video Init

At this point, you can initialize HDMI output from within Linux:

./hdmi_ctl

When this starts, you can set video output at a particular resolution using:

>> sv 14

That will select 720p on your HDMI monitor. "sv 24" will get you 1080p, "sv 25" will get 640x480.

Patching CForth

In order to manipulate the video parameters in real time, we use a second serial port connected to CForth running on the security processor. It must be enabled by holding down the "rotate" key while booting. Then start ofw using the command:

ok dbg ofw

The following forth commands need to be downloaded (over the second serial port):

: w1 20b000 + io! ;  : r1 20b000 + io@ ;
: video-on 104 r1 44 w1  fc r1 3c w1  f4 r1 34 w1  80 r1 100 or 80 w1  ;
alias v video-on
: +hdmi  20bc00 +  ;
: hdmi!  +hdmi io!  ;
: hdmi@  +hdmi io@  ;
: hdmi-i!  ( b reg# -- )  swap  0 hdmi!  h# 8000.0000 or 4 hdmi!  ;
: hdmi-i@  ( reg# -- b )  h# 4000.0000 or 4 hdmi!  0 hdmi@  ;
alias r hdmi@  alias w hdmi!   alias ii hdmi-i!   alias ir hdmi-i@
: access-phy  h# 20 hdmi@  1 or  h# 20 hdmi!  ;
alias phy access-phy
: access-3d  h# 20 hdmi@  1 invert and  h# 20 hdmi!  ;
alias 3d access-3d

And these allow for easier manipulation of the PHY0 and PHY1 registers:

6 value damp  5 value eamp  2 value cp
: phy0
   damp o# 1111 *
   eamp o# 11110000 * or
   cp h# 55000000 * or
   8 w
; 
0 value ajd  1 value svtx  9 value idrv  
: phy1
   ajd  h# f0000000 *
   svtx o# 1111 * d# 16 lshift  or
   idrv h# 1111 *  or
   h# c w
;

You can use these patches to manipulate the PHY registers by typing:

phy phy0 phy1

Display some video using

v

Changing PHY Settings

You must rerun CForth register settings after using hdmi_ctl. After changing the resolution with hdmi_ctl, you must re-run:

phy phy0 phy1

In order to change a value, change the associated variable and then re-write the related register. To change DAMP to 3:

3 to damp phy0

To change IDRV to 4:

4 to idrv phy1