4 4
davedsbca

PSA: Orange Pi Zero expansion board tv-out not working solution

Recommended Posts

On 12/28/2017 at 6:35 AM, martinayotte said:

Did you tried different TVs ?

VSync could be defective on the one you've tested ...

I didn't cause I just have one TV at home :( I tried to find some config on it but of course I couldn't change anything for RCA input.

 

Anyway I'll try to test in another device and I'll post if successful here.

 

Thanks in advance;

Share this post


Link to post
Share on other sites
(edited)
On 5/29/2017 at 3:17 PM, giri@nwrk.biz said:

 

Yeah!! I managed to fix the overscanning issue!  (Credits go to this guy here for pointing me to the right direction!).

 

All in all my Picture was Overscanning 20 px on every edge.

 

At first I changed my resolution from the detected 720x576 to 680x536 (2 * -20 px = -40 px) in the script.bin. This results in an visible edge at the bottom of the screen and an visible edge on the right hand side (with a small black border!).


$ bin2fex /boot/script.bin ~/script.fex
$ nano ~/script.fex

find these lines:
fb0_width = 0
fb0_height = 0

and change them to:
fb0_width = 680
fb0_height = 536

then:
$ fex2bin ~/script.fex ~/script.bin
$ sudo cp ~/script.bin /boot
$ sudo reboot

 

Now the picture needs to be moved down and to the right by 40px to be fully visible!

 

Next I needed to manipulate TV ENCODER RE-SYNC PARAMETERS REGISTER of the H2+ SoC. For this I used a little tool called devmem2 which helped me to directly read and write to the memory, and thus allowed me to manipulate the H2+ registers!

 

devmem2 can be installed by using following commands:


wget http://free-electrons.com/pub/mirror/devmem2.c
gcc ./devmem2.c
sudo mv ./a.out /usr/local/bin/devmem2

 

After Installing devmem2 I was able to shift the picture by manipulating the value on following Address: 0x01E00130! (=TV ENCODER RE-SYNC PARAMETERS REGISTER, this may differ depending on your SoC, check the Datasheet!)

First I read back the actual value (so I could revert back changes in case I messed anything up!):

 


$ sudo devmem2 0x01E00130 
/dev/mem opened.
Memory mapped at address 0xb6f0d000.
Value at address 0x1E00130 (0xb6f0d130): 0x3005000A

Now I was able to move the picture by writing a custom value to the register according to the R40 Datasheet: 

 

TV ENCODER RE-SYNC PARAMETERS REGISTER Datasheet entry:

  Reveal hidden contents

Re-Sync.png

 

Here is how I calculated this value with the help of the Datasheet:

31 ... Re-Sync Field => 0b 

30 ... Re-Sync Disable => 0b

29:27 ... not used => 000b

26:16 ... Vertical => 40d px => 0000101000b

15:11 ... not used => 00000b

10:0 ... Horizontal => 40d px => 0000101000b

 

All in All: 000000000101000000000000101000b => 0x00140028

So I used this command to set my display:


$ sudo devmem2 0x01E00130 w 0x00140028

EDIT: I created a small tool which does the work above for you ;)

 

Finally I saved the command above in my rc.local file to shift the picture during boot.


$ sudo nano /etc/rc.local

paste following line:
devmem2 0x01E00130 w 0x00140028

This is a dirty workaround and should be fixed within the driver!

 

Pictures:

 

  Hide contents

 

IMG_20170529_211717.jpg

IMG_20170529_211734.jpg

IMG_20170529_211806.jpg

 

 

Hope this helps to correct your overscanning issues! This should also work with many other Allwinner based Boards. I read that some Bananapi users had a pretty similar problem with overscanning on AV out.

 

 

On 6/4/2017 at 5:49 AM, giri@nwrk.biz said:

The script.bin filr is located at /boot/

 

You have to convert this file into .fex to make it editable. 

 


$ bin2fex /boot/script.bin ~/script.fex

 

After setting the resolution (somewhere near 'disp') you have to convert it back to .bin.


$ fex2bin ~/script.fex ~/script.bin
$ sudo cp ~/script.bin /boot/

 

Be wise, make a backup before editing ;)

 

On 6/4/2017 at 3:07 PM, giri@nwrk.biz said:

 


$ sudo nano /etc/rc.local

 

Paste your devmem2 or tvout command into this file. (without sudo)

 

This works here, using the pure armbian image. (see pic)

0d0e3e06_c34c_48f5_9376_45d4f85d8352.jpg

That was after editing the script.bin The resolution is ok. The 0s filled line was to make sure of that.

 

be145867_a788_4b30_bea4_407292980d32.jpg

And in this pic, a bit of shame with my linux commands. After successfully adjusting the screen position with tvout.


I was able to find the best resolution for my screen by following these steps.
Then using the tvout I was able to adjust the position easily. Thank you very much.
Now I just need to learn how to run the tvout command through rc.local But that's just a matter of getting familiar with the linux syntax. I would appreciate help with this.


Unfortunately, in the Armbian provided in the RetrOrangePi image I had the same problem of the quotes below:

 

On 6/6/2017 at 7:28 PM, fredjedimaster said:

Hi. Thanks for the rapid answers.

 

I'm using retrorange pi zero...After doing the first step, the screen gets the right size, but the system does not boot. What could it be?

 

 

 

On 6/10/2017 at 4:44 PM, Charley said:

I have the same issue. I follow the steps to a T but then after reboot (per instructions) I get no video. I am using RetrOrangepi 3.01 (OrangePiZero) as well. NTSC (on an old CRT TV).

 

 

On 6/18/2017 at 1:44 PM, rickgtx said:

I like to share my experiences with the orangepi zero with the expansion board.  First big thanks to giri@nwrk.biz for screen resolution fixes. 

 

I have an old 13" NTSC TV (640x440).  My Value at address 0x1E00130 (0xb6f85130): 0x30050368. 

To fit the xfce4 desktop on this TV, I had too set fb0_width = 620, fb0_height = 440, and tvout -m -x 100 -y 20 to center it.  This works on armbian Jessie, DietPi, and RetrOrangePi.

 

I had problems with tvout on DietPi and RetrOrangePi not producing the desired effect but devmem2 0x01E00130 w 0x300F03CC always worked.  (Once using tvout to center on armbian I use devmem2 0x01E00130 to get  0x300F03CC on DietPi and RetrOrangePi)

 

I had to set screen1_output_mode = 14 for NTSC in script.bin  I found, as did the OP, RaspberryPi video cable does not work.  But I had a Roku LT video cable that was fine,  The ground has to be on the sleeve not ring 2. I made no mods to the expansion board.

 

Unfortunately, I got orangepi zero v1.4 board that has a defect that causes it to run 50% hotter than the other versions of the orangepi zero.  Mine idles around 70C and goes to 80C when doing anything.  Armbian constantly throttles opi down to 240Mhz to get to 68C.  I ordered a heat sink if the opizero lasts that long.


Starting kernel ...
[sun8i_fixup]: From boot, get meminfo:
        Start:  0x40000000
        Size:   512MB
ion_carveout reserve: 160m@0 256m@0 130m@1 200m@1
ion_reserve_select: ion chipid  [0x2c00042!
ion_reserve_common: ion reserve: [0x57e00000, 0x60000000]!
Loading, please wait...
[    2.488304] thermal_sys: Critical temperature reached(110 C),shutting down
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... Scanning for Btrfs filesystems
[    3.022033] thermal_sys: Critical temperature reached(110 C),shutting down
[    3.145328] Power down.


 

 

After editing the script.bin and rebooting, the system apparently does not even give a screen signal.

Since so many people have signed up to the forum to ask for help with this, it must be something very recurrent.

So we have a basis for understanding the source of the problem. And it must be simple. It works in this version of the image: Armbian_5.25_Orangepizero_Debian_jessie_default_3.4.113.img

 

Please help the community to understand why Armbian does not load (or maybe load with no screen) after editing the script.ini in this Armbian's image:
RetrOrangePi-3.0.1.Orangepizero.img

 

(Detail: RetrOrangePi v4 runs smooth with more sophisticated hardware. For OrangePi Zero, the RetrOrangePi v3.0.1's EmulationStation has run better. That's why I'm using the v3.0.1)

 

Edited by Brun0
Spell check

Share this post


Link to post
Share on other sites
On 7/1/2018 at 12:58 PM, Brun0 said:

Now I just need to learn how to run the tvout command through rc.local But that's just a matter of getting familiar with the linux syntax. I would appreciate help with this.

 

The rc.local script is a simple bash script which is executed after boot. Just open it with an editor and paste the tvout command that fixed your resulution in there.

Should work somehow like this:

 

First copy tvout to /usr/local/bin, so it is in your PATH:

$ sudo cp /path/to/tvout /usr/local/bin

 

Now edit rc.local:

$ sudo nano /etc/rc.local

 

Should look something like this:

#! /bin/bash

tvout -m -x55 -y10
On 7/1/2018 at 12:58 PM, Brun0 said:

Unfortunately, in the Armbian provided in the RetrOrangePi image I had the same problem of the quotes below:

For RetrOrangePi related problems you should contact their froum/devs. They seem to have my tvout program included in their image and labeled overscanning issues fixed within their release notes, so I guess they know how to handle it.

Share this post


Link to post
Share on other sites
On 5/29/2017 at 11:17 AM, giri@nwrk.biz said:

Yeah!! I managed to fix the overscanning issue!  (Credits go to this guy here for pointing me to the right direction!).

 

All in all my Picture was Overscanning 20 px on every edge.

 

At first I changed my resolution from the detected 720x576 to 680x536 (2 * -20 px = -40 px) in the script.bin. This results in an visible edge at the bottom of the screen and an visible edge on the right hand side (with a small black border!).


$ bin2fex /boot/script.bin ~/script.fex
$ nano ~/script.fex

find these lines:
fb0_width = 0
fb0_height = 0

and change them to:
fb0_width = 680
fb0_height = 536

then:
$ fex2bin ~/script.fex ~/script.bin
$ sudo cp ~/script.bin /boot
$ sudo reboot

 

Now the picture needs to be moved down and to the right by 40px to be fully visible!

 

Next I needed to manipulate TV ENCODER RE-SYNC PARAMETERS REGISTER of the H2+ SoC. For this I used a little tool called devmem2 which helped me to directly read and write to the memory, and thus allowed me to manipulate the H2+ registers!

 

devmem2 can be installed by using following commands:


wget http://free-electrons.com/pub/mirror/devmem2.c
gcc ./devmem2.c
sudo mv ./a.out /usr/local/bin/devmem2

 

After Installing devmem2 I was able to shift the picture by manipulating the value on following Address: 0x01E00130! (=TV ENCODER RE-SYNC PARAMETERS REGISTER, this may differ depending on your SoC, check the Datasheet!)

First I read back the actual value (so I could revert back changes in case I messed anything up!):

 


$ sudo devmem2 0x01E00130 
/dev/mem opened.
Memory mapped at address 0xb6f0d000.
Value at address 0x1E00130 (0xb6f0d130): 0x3005000A

Now I was able to move the picture by writing a custom value to the register according to the R40 Datasheet: 

 

TV ENCODER RE-SYNC PARAMETERS REGISTER Datasheet entry:

  Reveal hidden contents

Re-Sync.png

 

Here is how I calculated this value with the help of the Datasheet:

31 ... Re-Sync Field => 0b 

30 ... Re-Sync Disable => 0b

29:27 ... not used => 000b

26:16 ... Vertical => 40d px => 0000101000b

15:11 ... not used => 00000b

10:0 ... Horizontal => 40d px => 0000101000b

 

All in All: 000000000101000000000000101000b => 0x00140028

So I used this command to set my display:


$ sudo devmem2 0x01E00130 w 0x00140028

EDIT: I created a small tool which does the work above for you ;)

 

Finally I saved the command above in my rc.local file to shift the picture during boot.


$ sudo nano /etc/rc.local

paste following line:
devmem2 0x01E00130 w 0x00140028

This is a dirty workaround and should be fixed within the driver!

 

Pictures:

 

  Reveal hidden contents

 

IMG_20170529_211717.jpg

IMG_20170529_211734.jpg

IMG_20170529_211806.jpg

 

 

Hope this helps to correct your overscanning issues! This should also work with many other Allwinner based Boards. I read that some Bananapi users had a pretty similar problem with overscanning on AV out.

 

I compile devmem2 but cannot write to register. It shows register value still the same

I have Banana Pi M2+ which has allwinner H3

 

root@bananapim2plus:~/Download/devmem# devmem2 0x01E00130 w 0x00140028
/dev/mem opened.
Memory mapped at address 0xb6fe2000.
Value at address 0x1E00130 (0xb6fe2130): 0xEBD771BF
Written 0x140028; readback 0xEBD771BF
 

Share this post


Link to post
Share on other sites
2 hours ago, dony71 said:

 

I compile devmem2 but cannot write to register. It shows register value still the same

I have Banana Pi M2+ which has allwinner H3

 

root@bananapim2plus:~/Download/devmem# devmem2 0x01E00130 w 0x00140028
/dev/mem opened.
Memory mapped at address 0xb6fe2000.
Value at address 0x1E00130 (0xb6fe2130): 0xEBD771BF
Written 0x140028; readback 0xEBD771BF
 

Try to use following tool: https://projects.nwrk.biz/projects/allwinner-tvout

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
4 4