Jump to content

Recommended Posts

Posted

Having invested many, many hours getting the video out to work on my recently purchased Orange Pi Zero kit, I'd like to leave this heads up for the next person having trouble with video out.  In my case, none of the advice I could find in this forum or elsewhere seemed to make any difference.  If you find yourself in a similar situation, here are some things you should know.

  1. The latest Armbian images for the OrangePi Zero enable composite video out by default.  It should just work.  (Well at least the Ubuntu image -- I never actually verified Debian Jesse worked after I fixed my expansion board.)  You should NOT need to fiddle with /etc/modules or .fex files.  Although that bit of information can be found in other posts on this forum, it took me a while to stumble across it, so I'm calling it out here.
  2. Don't trust the expansion board or your AV cable.  If you hook everything up and don't get video right away, the first thing to try is connecting your monitor directly to the GND and TV-OUT pins on the 13-pin connector.  Regretfully, I only resorted to this after much time spent futzing with other things.  In my case, not only was my expansion board borked, but the supposedly Zune/RaspberryPi compatible AV cable I got from Amazon actually had the ground and video swapped on the yellow RCA plug.
  3. The expansion board adds a bit of circuitry to the tv-out line, an inductor, two capacitors and a resistor, which I'm guessing is some sort of filter that attempts to "clean up" the video signal.  Being that you can hook up video directly to the OrangePi Zero without an expansion board, it would seem this filtering is entirely optional.
  4. I happened to notice (while checking continuity with a multitester) that the resistance between the GND and TV-OUT pins on the bare, unpowered OrangePi Zero board was effectively an open circuit, but when the expansion board was installed, it changed to approximately 50 ohms.  It seemed to me that all this would accomplish is to pull the composite video signal very close to ground and hold it there.  On a hunch, I took an Xacto knife and carefully scraped R359 from the filter circuit off of the expansion board.  This did the trick.  Now, with a proper AV cable,  my monitor could pick up a signal on its CVBS port.  I've attached a picture of the expansion board with the location of this resistor circled in red.  Maybe I just had a bad resistor, but if you've tried everything else, it may be worth knowing that removing this resistor can't hurt and is worth trying.

 

opi0-expansion.jpg

Posted

To add to this: The problem with the TRRS plug is that there exist a few pin/tip definitions so you can never trust any cable and the one Xunlong sells seems to use unusual color coding.

 

And if you solved this problem wasting a few hours of your live then most probably you run in huge overscan issues with your TV that can not be solved on OPi Zero side but only on TV's side (if at all):

 

In other words: consider CVBS broken by design and OPi Zero a headless device :) 

Posted
9 hours ago, davedsbca said:

I happened to notice (while checking continuity with a multitester) that the resistance between the GND and TV-OUT pins on the bare, unpowered OrangePi Zero board was effectively an open circuit, but when the expansion board was installed, it changed to approximately 50 ohms.  It seemed to me that all this would accomplish is to pull the composite video signal very close to ground and hold it there.  On a hunch, I took an Xacto knife and carefully scraped R359 from the filter circuit off of the expansion board.  This did the trick.  Now, with a proper AV cable,  my monitor could pick up a signal on its CVBS port.  I've attached a picture of the expansion board with the location of this resistor circled in red.  Maybe I just had a bad resistor, but if you've tried everything else, it may be worth knowing that removing this resistor can't hurt and is worth trying.

This should implement a basic impedance matching (though it should be closer to 75 Ohms than to 50 if I understand it correctly). All other Orange Pi boards that have CVBS output on the 3.5mm jack have this circuit on the main board.

Posted
On 20. 3. 2017 at 1:20 AM, davedsbca said:

supposedly Zune/RaspberryPi compatible AV cable I got from Amazon actually had the ground and video swapped on the yellow RCA plug.

 

On 20. 3. 2017 at 7:22 AM, tkaiser said:

The problem with the TRRS plug is that there exist a few pin/tip definitions so you can never trust any cable

 

Fortunatelly, most cables/wirings are either OMTP or CTIA compliant. For that reason, I bought cheap OMTP to CTIA adapter from ebay, which solves many annoyances and now I don't need to worry anymore about pinout.

Posted
On 20. März 2017 at 7:22 AM, tkaiser said:

To add to this: The problem with the TRRS plug is that there exist a few pin/tip definitions so you can never trust any cable and the one Xunlong sells seems to use unusual color coding.

 

And if you solved this problem wasting a few hours of your live then most probably you run in huge overscan issues with your TV that can not be solved on OPi Zero side but only on TV's side (if at all):

 

In other words: consider CVBS broken by design and OPi Zero a headless device :) 

 

 

Hey folks,

just registered to let you know it is possible to adjust the resolution of the Orange pi Zero by editing the framebuffer resolution in the script.fex file!

Posted

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:

Spoiler

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:

 

Spoiler

 

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.

Posted
1 hour ago, giri@nwrk.biz said:

I found this out on a trial and error basis, this information may be incorrect! A H2+ Datasheet would be nice, this would help us understanding this register and its flags..

 

TV unit is described only in A10 and R40 datasheet. Even in those two datasheets some register descriptions are missing, but they should be enough. You can find them through linux-sunxi.org

Posted
11 hours ago, jernej said:

 

TV unit is described only in A10 and R40 datasheet. Even in those two datasheets some register descriptions are missing, but they should be enough. You can find them through linux-sunxi.org

 

But CPU  H2+ registers and flags are not described in these datasheets.

Posted
2 minutes ago, giri@nwrk.biz said:

But CPU registers and flags are not described in these datasheets.

 

Which ones exactly? H2+ is actually H3, so you can take a look there. If you need ARM CPU registers, you can take a look at Cortex A7 user manual on ARM site.

Posted
On 30. Mai 2017 at 7:39 AM, jernej said:

 

Which ones exactly? H2+ is actually H3, so you can take a look there. If you need ARM CPU registers, you can take a look at Cortex A7 user manual on ARM site.

 

Sorry I have to correct myself, this is a peripheral register, I am sure this is not documented in the Cortex A7 manual because it is H3 specific. (SoC are built with arm cores + peripherals added by the SoC producer using a System Integration Tool [for example Intel Qsys]. These Componets are connected using a special Bus [Intel: Avalon Bus]).

 

I just checked the H3 Datasheet, but the only reference I found is in the memory mapping

TVE		0x01E0 0000---0x01E0 FFFF

 

The datasheet itself ony describes the TVE_Clock_Register which is located at offset 0x120.

 

EDIT:

Seems like I got my hands on the wrong R40 Document. I found the register description! This picture describes the register flags in binary format from 31 downto 0:

Spoiler

Re-Sync.png

 

 

 

The obove gathered info should make it possible to hack together an bash script to correct the overscanning issue.
I may get my hands dirty when I have enough spare time.

 

Quote

In other words: consider CVBS broken by design and OPi Zero a headless device :) 

 

 Would not say so! Just unflexible coded driver.

Posted
8 minutes ago, giri@nwrk.biz said:

I just checked the H3 Datasheet, but the only reference I found is in the memory mapping

As I said, only descriptions of TVE unit can be found in A10 and R40 manual. H3/H2+ TVE unit is something in between by functionality, but most of the registers are the same.

Posted
Just now, jernej said:

As I said, only descriptions of TVE unit can be found in A10 and R40 manual. H3/H2+ TVE unit is something in between by functionality, but most of the registers are the same.

Check my Edit ;)

Posted
On 2017-5-29 at 2:17 PM, giri@nwrk.biz said:

At first I changed my resolution from the detected 720x576 to 680x536 (2 * -20 px = -40 px) in the script.bin.

 

 

How i do that?

 

Can you say where in the script.bin?

 

Posted
8 hours ago, fredjedimaster said:

 

 

How i do that?

 

Can you say where in the script.bin?

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 ;)

Posted
On 29/05/2017 at 2:17 PM, giri@nwrk.biz said:

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

 

Another question, how did you do this?

 

I did everything, but the position of the screen didnt save. I guess its missing do save the command. Can you say how save the command in the rc.local?

Posted
1 hour ago, fredjedimaster said:

Another question, how did you do this?

 

I did everything, but the position of the screen didnt save. I guess its missing do save the command. Can you say how save the command in the rc.local?

 

$ sudo nano /etc/rc.local

 

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

Posted
13 hours ago, 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?

 

 

You need to provide more informations!

 

Steps you did, logfiles, screenshots, errormessages etc.

 

 

Posted
On 2017-6-4 at 4:49 AM, giri@nwrk.biz said:

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

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?

Posted

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).

 

Posted
On 10. Juni 2017 at 9: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).

 

What resolution did you set?

Did you try it with armbian too?

 

I don't know how much retrorangepie differs from armbian.

 

You can also try to set the resolution using fbset, but that did not work for me (not really supported by the driver).

Posted

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.


 

Posted

Nice to hear it worked for you :D!

 

17 hours ago, rickgtx said:

I had problems with tvout on DietPi and RetrOrangePi not producing the desired effect but devmem2 0x01E00130 w 0x300F03CC always worked.

tvout is moving the picture relative to its actual position. If you do not want this behavior you should call tvout -r first to reset your position.

 

Posted

This seems to be the most important thread for me in this forum. So I would like to know if anyone of you guys faced some problem like mine and if yes, how you guys solved?

 

I can boot any system on my opi zero (armbian, h3droid, retrorangepi, the ones release for xunlong team) bit h

The image in my tv out keeps roling quickly from bottom to top and I cannot even read to try fix it.

 

I really need this out to work, even with bad video quality.

 

If someone know something to help me here, please share.

 

Note: using xunlong 3.5mm to rca cable (red as video out)...san disk ultra as sd card. Xunlong 2A power supply (same result with others)

 

Posted
19 hours ago, jernej said:

I never had any similar issues, so I can give you only generic advice - test different and/or shorter cables.

Thank you for the answer. by the way I tried using directly the 13 pins interface (ground + tv out) and the result is the same. maybe some problem with this new board v 1.4. I'm asking partial refund once I cannot use the TV out but still being able to use it remotely 

 

thanks in advance. 

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...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines