P2 DVI/VGA driver - Page 2 — Parallax Forums

# P2 DVI/VGA driver

• Posts: 4,956
1k on the 5V out you mean?
• Posts: 13,939
edited 2019-11-22 05:32
Can't we just use %111000 for the output drive? That would drive low and float high. I think the pin resistance is ~20 ohms, so maybe add 80-ohm series resistors?
• Posts: 4,589
yep 1k resistor soldered between the 5v pad adjacent to the smt 12 pin header, to the 5v pin that connects to pin 18 of the hdmi socket
In effect feeding 5v from the p2es rev B board through to pin 18 of the hdmi socket, via that 1k resistor
Its one less mystery, but not the mystery we really want solved...
• Posts: 4,956
edited 2019-11-22 05:42
Reading this part below seems to imply to me that we shouldn't be operating at the low end with the BITDAC but at the higher end of the P2 voltage range. If the single ended swing is between 400mV and 600mV through the termination resistor I wonder if something using the BITDAC settings of 1111_1011 might be quite good?

EDIT: Actually rethinking these numbers, they don't take into account the 123 ohm P2 impedance, so we might need a larger swing to accommodate that, more like 1111_1001 perhaps.
• Posts: 4,956
cgracey wrote: »
Can't we just use %111000 for the output drive? That would drive low and float high. I think the pin resistance is ~20 ohms, so maybe add 80-ohm series resistors?

That worked for me directly without resistors.
• Posts: 13,939
rogloh wrote: »
cgracey wrote: »
Can't we just use %111000 for the output drive? That would drive low and float high. I think the pin resistance is ~20 ohms, so maybe add 80-ohm series resistors?

That worked for me directly without resistors.

Does %000000 fail, where it's driven for both high and low?
• Posts: 4,956
No it doesn't fail, it works for me and that is how I did all my development, but I didn't like the idea of that being the default in the code I released because there was no protection resistance except for 20 ohms. The BITDAC has 123 ohms which at least gives you something.
• Posts: 13,939
rogloh wrote: »
No it doesn't fail, it works for me and that is how I did all my development, but I didn't like the idea of that being the default in the code I released because there was no protection resistance except for 20 ohms. The BITDAC has 123 ohms which at least gives you something.

What is the impedance supposed to be? 100 ohms?
• Posts: 4,956
It says the termination impedances Rt and the characteristic cable impedance Zo must be matched so I guess it should really be 50 ohms source impedance to match that too, so your 20 ohms is closer, but 123 ohms gives you a bit more protection perhaps from over voltages on the DVI/HDMI equipment, or maybe it all gets diode clamped anyway.
• Posts: 10,250
Yes
• Posts: 4,956
edited 2019-11-22 05:58
Differential impedance 2x50 ohms = 100ohms? I can't recall this transmission theory stuff, been too long.
• Posts: 13,939
edited 2019-11-22 05:59
Yep, those diode clamps are always there. So, maybe we should use the same 27 ohm series resistors that USB uses, and then just configure the pins for high-float and low-drive.
• Posts: 4,956
rogloh wrote: »

That worked for me directly without resistors.

Regarding using the float high, drive low approach of %111_000, now I've left it running more, I see a few sparkly pixels in some places on that setting so it's not ideal.
• Posts: 4,956
I think the BITDAC option might be good, even though the source impedance is a bit high. Maybe we could throw parallel resistors to ground to lower it? Pulling the pin all the way low with 20 ohms seems to violate the DVI spec swing level and it would be too low a voltage.
• Posts: 4,956
edited 2019-11-22 06:18
This setting worked. Float high, 1k5 to ground. Should be safe but don't know how universal.

wrpin ##%111001<<8, a
• Posts: 13,939
rogloh wrote: »
This setting worked. Float high, 1k5 to ground. Should be safe but don't know how universal.

wrpin ##%111001<<8, a

Interesting that float/1r5k works, but float/20r doesn't. Whatever the solution, it shouldn't be more than a few resistors.
• Posts: 4,956
Maybe because it doesn't have as far to float back to the high voltage sensing range compared to when pulled closer to zero voltage. ie. It's cable capacitance related.
• Posts: 15,095
rogloh wrote: »
Maybe because it doesn't have as far to float back to the high voltage sensing range compared to when pulled closer to zero voltage. ie. It's cable capacitance related.

Yes, the spec is 150mV over 50 ohms per side min, so that's 3mA min.
Current drive from P2 would be best,(4~6mA?) but failing that, a series R should mean less swing on the cable.
So long as the cable terminates in it's matched impedance, there should be no reflections, ie 50 ohm drive is not needed.
The examples all show current differential drive.
• Posts: 4,956
I think if you build a dedicated board you can design it right, but for people already using the direct P2-EVAL breakout using Parallax supplied Digital Video Out board without resistors, perhaps this float/1.5k setting is okay, OR if it varies from cable/setup we can try the BITDAC approach.

I felt rather uneasy about having the direct 0V drive down and 3.3V drive up approach I'd been using myself in my driver (so I went and released it with the 1.5k drive coded in for high and low) but perhaps with the 50 ohm termination in the DVI/HDMI receiver it shouldn't ever be a dead short. This float up and 1.5k pull down seems safe(ish?) if it also works for other people. We sort of need people to try it out to see if it works.

Alternatively the BITDAC level version might be a more universal/well constrained solution to be used with the Digital Video Out board.
• Posts: 10,250
My screen is borrowed, but I am going to use one of those HDMI switchers. Blow that, nobody cares.

• Posts: 4,956
edited 2019-11-22 07:18
Fair enough, though one problem might be that your switcher may not like the P2's DVI signals without I2C, or the 5V thing so you may have to do the same as Tubular did and strap to the 5V pin with a 1k5 resistor.

By the way if you get stuck @potatohead, you can always mess around in VGA or component mode with my driver, these offer much higher resolutions to DVI anyway on the P2, though not quite as cool.
• Posts: 10,250
Yeah. We are going to find out. Looks to me like most of what has been tried seems to have been OK. In the analog realm, I know this stuff cold. Abused it many times, no worries.

This is new, so baby steps.

• Posts: 13,939
edited 2019-11-22 07:31
I think the coolest setup is Y-Pb-Pr 1080P (component HDTV). It only takes 3 analog pins and provides good resolution (1920 x 1080) on inexpensive TV's. You can get monochrome 1080P with just the Y signal on one pin. The only downside is that it uses bulky RCA plugs. I think on our A/V accessory board, we have a 1/8" 4-conductor plug that could carry the three signals.
• Posts: 4,956
edited 2019-11-22 12:43
Yeah component HD works out well with it's 3 pins and looks pretty nice like RGB. I've been using that A/V breakout board you mentioned Chip with the 3 cables with RCA connectors. Though, one further downside I found with my setup a least was that there was some overscan applied I couldn't seem to get rid of in my monitor's scaler settings so you can sometimes lose the information at the sides. Not so bad for graphics or video use, more of an issue for text. You can always compensate for it by adding more front and rear porch and shrinking the active area respectively, or tweak the timing to try to send all 1280/1920 pixels in the visible area.
• Posts: 4,956
By the way for those that didn't download the zip file in the top post, here is the summary of the feature set this video driver provides.
```'******************************************************************************
'*                                                                            *
'*   P2 VGA/DVI/TV graphics and text mode video driver features               *
'*   ===============================================================          *
'*                                                                            *
'*  This driver was inspired by original P2 video test code from Chip Gracey. *
'*  Since then it has expanded with many features and capabilities identified *
'*  below.  Thanks also for some assistance & suggestions from Parallax forum *
'*  members who helped find optimizations allowing performance improvements.  *
'*                                                                            *
'*  Features:                                                                 *
'*                                                                            *
'*    - fully programmable output resolution and timing                       *
'*    - selectable DVI/VGA/SDTV/HDTV output mode and P2 pin group             *
'*    - multiple VGA sync options: RGBHV, RGBS, RGsB (SyncOnGreen) support    *
'*    - component HDTV video support up to 1080i (YPrPb)                      *
'*    - PAL or NTSC SDTV video over composite/S-video/component               *
'*    - interlaced or progressive scan output                                 *
'*    - all P2 colour formats are supported in graphics mode                  *
'*    - built in 16 colour text mode renderer                                 *
'*    - programmable font size (1-256 scanlines), 8 pixel wide font           *
'*    - up to 240 text columns supported in 1920 pixel wide mode              *
'*    - optional text blinking attribute (VGA style 16 bit text data format)  *
'*    - interlaced text font output support                                   *
'*    - fine text scrolling capability                                        *
'*    - pixel width doubling, scanline doubling in all output modes           *
'*    - dynamic colourspace converter parameters loaded per frame             *
'*    - multiple independently sized text or graphics regions per screen      *
'*    - a programmable mouse sprite available in all graphics/text regions    *
'*    - region specific mouse image data, palettes and/or fonts               *
'*    - selectable global mouse/region specific mouse co-ordinates            *
'*    - dual text cursors with independent attributes & colours per region    *
'*    - programmable top/bottom/side borders (per pixel boundary)             *
'*    - programmable border colour (24 bit)                                   *
'*    - programmable scanline source data skew/pitch                          *
'*    - screen source buffer wraparound options per region allowing scrolling *
'*    - per scanline status update for supporting external sprite drivers     *
'*    - support for odd/even field/frame automatic page flipping              *
'*    - software interface for requesting frame buffers from external memory  *
'*    - low system clock speeds supported using transparent pass through mode *
'*    - scalable performance, high clock cycle use features can be disabled   *
'*                                                                            *
'*  Revision history:                                                         *
'*  -----------------                                                         *
'*   0.8b 21 NOV 2019  rogloh       -initial BETA release-                    *
'*                                                                            *
'******************************************************************************
```
• Posts: 4,956
edited 2019-11-23 00:22
And here is a handy summary of the control registers to set up the display and the display region list, the main documentation file explains it all in further detail.
```'==============================================================================
'
'                   Control Parameter Format Summary
'                   --------------------------------
'
'
'  31  30  29  28:24 23       16 15                          0
'  -----------------------------------------------------------
' | V | F | B |00000|Field Count|  Active Scanlines Displayed | STATUS
'  -----------------------------------------------------------
'
'  bit                                                       bit
'  31  30  29       24 23    20 19                           0
'  -----------------------------------------------------------
' | D | V |SyncOutputs|PinGroup| Custom Video Timing Address  | INITIALIZATION
'  -----------------------------------------------------------
'
'  31                                                        0
'  -----------------------------------------------------------
' |                         Reserved                          | RESERVED_1
'  -----------------------------------------------------------
'
'  31  30     24 23  20 19                                   0
'  -----------------------------------------------------------
' | E | Spacing |Offset|    External Memory Mailbox Address   | EXT_MEM_MAILBOX
'  -----------------------------------------------------------
'
'   31           24 23                                        0
'  -----------------------------------------------------------  LINE_BUFFER_1
' |   Reserved(0) |         Line Buffer Start Address         |
'  -----------------------------------------------------------  LINE_BUFFER_2
'
'  31                                                        0
'  -----------------------------------------------------------
' |                         Reserved                          | RESERVED_2
'  -----------------------------------------------------------
'
'  31                        16 15                           0
'  -----------------------------------------------------------
' |      Mouse Y position      |       Mouse X position       | GLOBAL_MOUSE
'  -----------------------------------------------------------
'
'  31                        16 15                           0
'  -----------------------------------------------------------
' |     Bottom Border Size     |       Top Border Size        | BORDER_SIZE
'  -----------------------------------------------------------
'
'  31          24 23         16 15            8 7            0
'  -----------------------------------------------------------
' |     Red      |    Green    |      Blue     | Border Width | BORDER_COLOUR
'  -----------------------------------------------------------
'
'  31                                                        0
'  -----------------------------------------------------------
' |                    First Region Pointer                   | FIRST_REGION
'  -----------------------------------------------------------
'
'  31                                                        0
'  -----------------------------------------------------------
' |                     Y Parameter Value                     | Y_PARAMETER
'  -----------------------------------------------------------
'
'  31                                                        0
'  -----------------------------------------------------------
' |                     I Parameter Value                     | I_PARAMETER
'  -----------------------------------------------------------
'
'  31                                                        0
'  -----------------------------------------------------------
' |                     Q Parameter Value                     | Q_PARAMETER
'  -----------------------------------------------------------
'
'..............................................................................
'  31                                                        0
'  -----------------------------------------------------------
' |                     Next Region Pointer                   | NEXT_REGION
'  -----------------------------------------------------------
'
'  31                        16 15           8 7             0
'  -----------------------------------------------------------
' |        Region Size         | Region Flags |  Colour mode  | REGION_CONFIG
'  -----------------------------------------------------------
'
'  31 30-28 27  24 23                                        0
'  -----------------------------------------------------------  SCREEN_BUFFER_1
' | E |Rsvd| Bank |        Screen Buffer Base Address         |
'  -----------------------------------------------------------  SCREEN_BUFFER_3
'
'  31 30-28 27  24 23                                        0
'  -----------------------------------------------------------  SCREEN_BUFFER_2
' | E |Rsvd| Bank |        Screen Buffer Wrap Address         |
'  -----------------------------------------------------------  SCREEN_BUFFER_4
'
'  31           24 23                                        0
'  -----------------------------------------------------------
' | Last Font Line|        Font Table Base Hub Address        | FONT_BUFFER
'  -----------------------------------------------------------
'
'  31           24 23                                        0
'  -----------------------------------------------------------
' |  Reserved(0)  |         Palette Base Hub Address          | PALETTE_BUFFER
'  -----------------------------------------------------------
'
'  31           24 23        16 15          8 7             0
'  -----------------------------------------------------------  CURSOR_1
' |  Cursor Row   |   Column   |  Attributes  | Colour Indexes|
'  -----------------------------------------------------------  CURSOR_2
'
'  31                        16 15                           0
'  -----------------------------------------------------------
' |      Mouse Y position      |       Mouse X position       | REGION_MOUSE
'  -----------------------------------------------------------
'
'  31   28 27   24 23                                        0
'  -----------------------------------------------------------
' | Y hot | X hot |         Mouse Sprite Hub Address          | MOUSE_SPRITE
'  -----------------------------------------------------------
'
'  31                        16 15                           0
'  -----------------------------------------------------------
' |   Scanline Offset/Rewrap   |    Source Wrap Scanlines     | SOURCE_WRAP
'  -----------------------------------------------------------
'
'  31                                                        0
'  -----------------------------------------------------------
' |                    Scanline Skew (or Pitch)               | SOURCE_SKEW
'  -----------------------------------------------------------
'
'==============================================================================
```
• Posts: 13,939
That video driver sure does a lot of things. I look forward to seeing a video of it being demonstrated, since you'll know how to show it off best.
• Posts: 10,250
edited 2019-11-22 14:58
Component is my favorite too Chip. There are converter chips we can use on a breakout to get that to HDMI. I see some devices actually do that to 4K HDMI. Wonder whether cranking the pixel clock up on one of those would deliver more than 1920 pixels?

But, I do really want to experiment and learn what we can really do with HDMI directly. It's hackable.
• Posts: 4,589
I've inserted some 4 component resnet blocks in between P2 and HDMI socket for whatever we work out

I'm also going to check what value of resistor the 5v sense of the TVL monitor works up to
• Posts: 4,589