randyrossi / bmc64

A bare metal Commodore 64 emulator for the Raspberry Pi with true 50hz/60hz smooth scrolling, low input latency and better audio/video sync.
GNU General Public License v3.0
488 stars 59 forks source link

DPI-output DE-pin csync-mode doesn't work #115

Closed mcgurk closed 4 years ago

mcgurk commented 4 years ago

First of all, huge thanks for BCM64. After adding support for DPI-display, there is only one obstacle to easily get holy grail: true 240p/288p RGB-component-SCART. Something that even real Commodore 8-bit machines cannot do easily.

I have made RGB-SCART-cable from VGA666-adapter. RGB-SCART needs combined V- and H-syncs as signal named csync. Combining syncs can be done with couple of external components, but Rasperry Pi can do it itself with feature named DPI_OUTPUT_ENABLE_MODE_COMBINED_SYNCS. My cable works with RetroPie with /boot/config.txt: dtoverlay=dpi24 enable_dpi_lcd=1 display_default_lcd=1 dpi_group=2 dpi_mode=87 dpi_timings=320 1 14 46 28 256 1 17 32 9 0 0 0 50 0 6400000 1 # PAL dpi_output_format=0x105

My cable: GND/pin6 -> 17 (scart) DE/GPIO1/pin28 -> 20 (scart) # csync R,G,B from VGA666 1,2,3 -> 15,11,7 (scart) 3.3V/pin17 -> 16 (scart) # blanking

If I understood correctly when using RetroPie, dtoverlay=dpi24 sets all pins to right mode (alt func 2). dpi_output_format=0x105 activates combined sync mode for DE-pin/GPIO1 (that "1" enables DPI_OUTPUT_ENABLE_MODE_COMBINED_SYNCS bit). If I check in RetroPie GPIO1 with logic analyzer, I see V and H sync combined with AND (both are normally high and if either goes down, csync goes down).

With BCM64 I see V-sync ja H-sync in GPIO2 and 3. Pixel clock shows in GPIO0. VGA-display works as expected, but scart doesn't and DE/GPIO1 looks like being Display Enable-mode (default), not in Combined_Syncs-mode. My machines.txt is: [C64/PAL/DPI/VGA666:720p@50hz] enable_dpi=true machine_timing=pal-custom cycles_per_second=982734 enable_dpi_lcd=1 display_default_lcd=1 dpi_group=2 dpi_mode=87 dpi_timings=320 1 14 46 28 256 1 17 32 9 0 0 0 50 0 6400000 1 # 320:256 Amiga (PAL) dpi_output_format=0x105 scaling_params=384,240,1152,720

This page can translate dpi_output_format magic number to something understandable: http://retrogamerestore.com/DPI/dpi_out_format_setting.php

Then I tried to debug with normal VGA-monitor and using dpi_output_format=0x125, which should swap blue and red channels. This test works with RetroPie, but didn't swap colors in BCM64. My first guess is that dpi_output_format -setting is not somehow used at all.

randyrossi commented 4 years ago

From the sounds of it, it should work. All 28 pins are set to Alt2 when enable_dpi=true in cmdline.txt and dpi_output_format should be set in the config.txt.

Can you confirm that after switching to the machine you defined, that your config.txt has the expected settings (dpi_output_format, etc) at the bottom and cmdline.txt has enable_dpi=true? (I just wanted to confirm you switched since adding the machines.txt isn't enough unless you do a switch as well from the menu)

I think dpi_output_format is read by one of the bootloader stages so it's not possible for it to be ignored. The only thing I can think of is the Alt2 mode is not right but I can see in my code I set them all to Alt2 as longs as enable_dpi=true is in cmdline.txt.

Can you attach your cmdline.txt and config.txt ?

On Tue, Feb 25, 2020 at 2:45 PM Jarno Lehtinen notifications@github.com wrote:

First of all, huge thanks for BCM64. After adding support for DPI-display, there is only one obstacle to easily get holy grail: true 240p/288p RGB-component-SCART. Something that even real Commodore 8-bit machines cannot do easily.

I have made RGB-SCART-cable from VGA666-adapter. RGB-SCART needs combined V- and H-syncs as signal named csync. Combining syncs can be done with couple of external components, but Rasperry Pi can do it itself with feature named DPI_OUTPUT_ENABLE_MODE_COMBINED_SYNCS. My cable works with RetroPie with /boot/config.txt: dtoverlay=dpi24 enable_dpi_lcd=1 display_default_lcd=1 dpi_group=2 dpi_mode=87 dpi_timings=320 1 14 46 28 256 1 17 32 9 0 0 0 50 0 6400000 1 # PAL dpi_output_format=0x105

My cable: GND/pin6 -> 17 (scart) DE/GPIO1/pin28 -> 20 (scart) # csync R,G,B from VGA666 1,2,3 -> 15,11,7 (scart) 3.3V/pin17 -> 16 (scart) # blanking

If I understood correctly when using RetroPie, dtoverlay=dpi24 sets all pins to right mode (alt func 2). dpi_output_format=0x105 activates combined sync mode for DE-pin/GPIO1 (that "1" enables DPI_OUTPUT_ENABLE_MODE_COMBINED_SYNCS bit). If I check in RetroPie GPIO1 with logic analyzer, I see V and H sync combined with AND (both are normally high and if either goes down, csync goes down).

With BCM64 I see V-sync ja H-sync in GPIO2 and 3. Pixel clock shows in GPIO0. VGA-display works as expected, but scart doesn't and DE/GPIO1 looks like being Display Enable-mode (default), not in Combined_Syncs-mode. My machines.txt is: [C64/PAL/DPI/VGA666:720p@50hz] enable_dpi=true machine_timing=pal-custom cycles_per_second=982734 enable_dpi_lcd=1 display_default_lcd=1 dpi_group=2 dpi_mode=87 dpi_timings=320 1 14 46 28 256 1 17 32 9 0 0 0 50 0 6400000 1 # 320:256 Amiga (PAL) dpi_output_format=0x105 scaling_params=384,240,1152,720

This page can translate dpi_output_format magic number to something understandable: http://retrogamerestore.com/DPI/dpi_out_format_setting.php

Then I tried to debug with normal VGA-monitor and using dpi_output_format=0x125, which should swap blue and red channels. This test works with RetroPie, but didn't swap colors in BCM64. My first guess is that dpi_output_format -setting is not somehow used at all.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/randyrossi/bmc64/issues/115?email_source=notifications&email_token=AAI3HKF3YLC7L6I6D4PB3JTREVYNNA5CNFSM4K3QZ4TKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IQFSOVA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3HKFSF5Y56S7TXMIUIODREVYNNANCNFSM4K3QZ4TA .

-- Randy Rossi

C:(+1)416-605-5112 (Canada)

randyrossi commented 4 years ago

Can you try adding this to your config.txt?

gpio=0-27=a2,np

It might be the no pull up missing from my init code.

On Tue, Feb 25, 2020 at 4:13 PM Randy Rossi randy.rossi@gmail.com wrote:

From the sounds of it, it should work. All 28 pins are set to Alt2 when enable_dpi=true in cmdline.txt and dpi_output_format should be set in the config.txt.

Can you confirm that after switching to the machine you defined, that your config.txt has the expected settings (dpi_output_format, etc) at the bottom and cmdline.txt has enable_dpi=true? (I just wanted to confirm you switched since adding the machines.txt isn't enough unless you do a switch as well from the menu)

I think dpi_output_format is read by one of the bootloader stages so it's not possible for it to be ignored. The only thing I can think of is the Alt2 mode is not right but I can see in my code I set them all to Alt2 as longs as enable_dpi=true is in cmdline.txt.

Can you attach your cmdline.txt and config.txt ?

On Tue, Feb 25, 2020 at 2:45 PM Jarno Lehtinen notifications@github.com wrote:

First of all, huge thanks for BCM64. After adding support for DPI-display, there is only one obstacle to easily get holy grail: true 240p/288p RGB-component-SCART. Something that even real Commodore 8-bit machines cannot do easily.

I have made RGB-SCART-cable from VGA666-adapter. RGB-SCART needs combined V- and H-syncs as signal named csync. Combining syncs can be done with couple of external components, but Rasperry Pi can do it itself with feature named DPI_OUTPUT_ENABLE_MODE_COMBINED_SYNCS. My cable works with RetroPie with /boot/config.txt: dtoverlay=dpi24 enable_dpi_lcd=1 display_default_lcd=1 dpi_group=2 dpi_mode=87 dpi_timings=320 1 14 46 28 256 1 17 32 9 0 0 0 50 0 6400000 1 # PAL dpi_output_format=0x105

My cable: GND/pin6 -> 17 (scart) DE/GPIO1/pin28 -> 20 (scart) # csync R,G,B from VGA666 1,2,3 -> 15,11,7 (scart) 3.3V/pin17 -> 16 (scart) # blanking

If I understood correctly when using RetroPie, dtoverlay=dpi24 sets all pins to right mode (alt func 2). dpi_output_format=0x105 activates combined sync mode for DE-pin/GPIO1 (that "1" enables DPI_OUTPUT_ENABLE_MODE_COMBINED_SYNCS bit). If I check in RetroPie GPIO1 with logic analyzer, I see V and H sync combined with AND (both are normally high and if either goes down, csync goes down).

With BCM64 I see V-sync ja H-sync in GPIO2 and 3. Pixel clock shows in GPIO0. VGA-display works as expected, but scart doesn't and DE/GPIO1 looks like being Display Enable-mode (default), not in Combined_Syncs-mode. My machines.txt is: [C64/PAL/DPI/VGA666:720p@50hz] enable_dpi=true machine_timing=pal-custom cycles_per_second=982734 enable_dpi_lcd=1 display_default_lcd=1 dpi_group=2 dpi_mode=87 dpi_timings=320 1 14 46 28 256 1 17 32 9 0 0 0 50 0 6400000 1 # 320:256 Amiga (PAL) dpi_output_format=0x105 scaling_params=384,240,1152,720

This page can translate dpi_output_format magic number to something understandable: http://retrogamerestore.com/DPI/dpi_out_format_setting.php

Then I tried to debug with normal VGA-monitor and using dpi_output_format=0x125, which should swap blue and red channels. This test works with RetroPie, but didn't swap colors in BCM64. My first guess is that dpi_output_format -setting is not somehow used at all.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/randyrossi/bmc64/issues/115?email_source=notifications&email_token=AAI3HKF3YLC7L6I6D4PB3JTREVYNNA5CNFSM4K3QZ4TKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IQFSOVA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI3HKFSF5Y56S7TXMIUIODREVYNNANCNFSM4K3QZ4TA .

-- Randy Rossi

C:(+1)416-605-5112 (Canada)

  • "There are only two things that are hard about computer science; Naming things, Cache Invalidation, and Off-by-one errors."

-- Randy Rossi

C:(+1)416-605-5112 (Canada)

mcgurk commented 4 years ago

This is awkward... I tried settings by editing just machines.txt and I didn't realize go to BCM64-settings again to activate changes. My bad. Now it works and it outputs progressive RGB signal to scart-cable and to CRT-television with just VGA666 and some wire and scart-connector :)!