DVD Drive IO voltage

Portables, case replacements, mods etc, all in here!
User avatar
emu_kidid
Site Admin
Posts: 4927
Joined: Mon Mar 29, 2010 10:06 am
Location: Australia
Contact:

Re: DVD Drive IO voltage

Post by emu_kidid » Tue Dec 16, 2014 9:54 pm

Sounds like a good plan :)
Image
pyroholic
Posts: 58
Joined: Tue Nov 25, 2014 8:22 am

Re: DVD Drive IO voltage

Post by pyroholic » Fri Dec 26, 2014 3:54 pm

Seems like it was a good plan as well :) Since it has been holidays I've had some time over to do some hacking and now I have a prototype that seems to be working (not without bugs or with all features though). I have not tested so many games yet but Metroid Prime (PAL) booted fine and seems to run OK as well. Paper Mario (NTSC) does not boot but the PAL version boots. My cube is PAL version so maybe it is region problems. How does the region checking actually work? Is it done by the drive or the main CPU?

Anyway, this feels like a good start. It has proceeded without any major issues and i have managed to get results pretty fast. Since most of the boring stuff such as setting up the build environment is also done I can spend most of the time with actual coding which is fun :)
pyroholic
Posts: 58
Joined: Tue Nov 25, 2014 8:22 am

Re: DVD Drive IO voltage

Post by pyroholic » Fri Dec 26, 2014 4:47 pm

Well, figured out the region thingy now. My googling skills seem to almost always non-existing prior to posting a question. But i patched the region code in the header to match my PAL discs and now it works. So I'm thinking that patching is no problem to do on the fly in the drive emulator. The question though, is there any region-free code? Or do I need to patch it into the region of the current console?
novenary
Posts: 1754
Joined: Mon Dec 30, 2013 7:50 am

Re: DVD Drive IO voltage

Post by novenary » Sat Dec 27, 2014 12:00 am

Nice to hear you got it working. I think you need to patch according to the console. You can probably detect it somehow but you need to inject code into the apploader like the XenoGC does
User avatar
emu_kidid
Site Admin
Posts: 4927
Joined: Mon Mar 29, 2010 10:06 am
Location: Australia
Contact:

Re: DVD Drive IO voltage

Post by emu_kidid » Sat Dec 27, 2014 11:46 am

You need to patch 0x03 and 0x45B I believe. If you look at what Xeno does, it fakes the Apploader size to load a few extra PPC instructions which then end up changing the 0x800000CC video byte to match the forced region so that the game doesn't green screen. Of course all of this is handled by Swiss too much better :P
Image
pyroholic
Posts: 58
Joined: Tue Nov 25, 2014 8:22 am

Re: DVD Drive IO voltage

Post by pyroholic » Sat Dec 27, 2014 6:38 pm

Thanks for the input. Luigis Mansion seems to work fine regardless of original region if I patch 0x45b, but the other titles I've tried does not. They blackscreen and freeze after the intro logotype, so I guess that the video mode might be the reason as you mentioned. Booting the swiss iso first there is no problem to boot either of the games however, so i guess there is not much reason to dig deeper into this. Gotta say that swiss is awesome, worked straight out of the box with my implementation so i thought that was pretty cool. I just boot swiss, switch iso in the program and then reinitialize the drive in swiss and it works fine. I have some more stuff to fix for the drive emulator it self first, such as audio streaming, error handling and also some other stuff, but then it would be cool with a neat interface in swiss to select iso-files :D
pyroholic
Posts: 58
Joined: Tue Nov 25, 2014 8:22 am

Re: DVD Drive IO voltage

Post by pyroholic » Sun Dec 28, 2014 9:33 pm

I have now merged the video component with the drive component, so of course i have hit some snags... It works awesome as long as I don't use progressive scan. But when I activate progressive mode the games crash, most oftenly before getting anywhere near gameplay. And if I manage to get the game started then it will crash at random places, and usually within a minute after entering the game. If I play in standard interlaced mode, all games seem to be running stable. I do not have this problem when i run NTSC backups using the dvd-drive with viper chip and cobra bios, so it seems a bit strange to me. Just to try something else I took the code that xenogc injects into the apploader for region and video mode and i get the same results when i boot them using that method, it works fine with interlaced but crashes in progressive. Does anybody have any ideas?
User avatar
Unseen
Posts: 190
Joined: Fri Jul 04, 2014 11:52 am

Re: DVD Drive IO voltage

Post by Unseen » Sun Dec 28, 2014 10:00 pm

pyroholic wrote:Does anybody have any ideas?
Since you mentioned "merged" I assume that you run everything into the same FPGA, so maybe you have some crosstalk between the video data lines and the drive signals?

I also saw some "works better in interlaced mode than in progressive" problems when I added SPDIF to gcvideo (not on Github yet) and in the end I solved it by adding a simple deglitching module that only accepts a new level on a signal when it had the same value during the last three clock cycles. Since the drive control signals are likely much faster than I2S audio signals, you may need to generate a faster clock internally to properly oversample the incoming data signals.

Of course I may be completely wrong here - if you have a sufficiently fast logic analyzer or DSO available you could try to send your input signals directly to some test pins on your FPGA board and monitor them for short glitches that shouldn't be there.

Another thing that may be worthwile to check is if you really sample your signals on the correct clock edge. The digital video signals of the cube are changing on the rising edge of the 54MHz clock of that port, so they should be sampled on the falling edge, but I don't know how the DVD interface works. In GCVideo this fact is hidden away by a "not" operator directly on the input clock, if your video module uses my code you may have switched your clock edge without realizing it.
Asking for support by PM is anti-social. Ask in an open forum instead, so other people can benefit from the answers!
pyroholic
Posts: 58
Joined: Tue Nov 25, 2014 8:22 am

Re: DVD Drive IO voltage

Post by pyroholic » Sun Dec 28, 2014 10:50 pm

Yup everything runs on the same fpga. I think you might be right on the cross-talk, I've managed to observe some strange behavior with the logic analyzer. What seems strange though is that all input signals look fine, but internal counters and signals are behaving pretty strange. The drive interface is pretty slow, the gamecube writes data at 20 MHz and from what i could measure on the drive, it seems to write at about 13-13.5 MHz so those signals are much slower than the video interface. But I run some logic stuff a bit faster, so i might be worth a shot to lower those frequencies. I'm using a pll to phase-shift video clock so I've had no issues there, video is stable all the time and works when the cube crashes, so no issues there.
pyroholic
Posts: 58
Joined: Tue Nov 25, 2014 8:22 am

Re: DVD Drive IO voltage

Post by pyroholic » Mon Dec 29, 2014 10:31 am

I seem to have managed to fix it by changing approach. Instead of using the input clock signal from the cubes drive controller as an input clock i sample it with a clock that is faster. First I used my 100 MHz internal clock, but that was no good either so I thought, why not use a multiple of the video clock since that is the clock that's interfering. So I ended up using a doubled video clock at 108 MHz with the same phase alignment, and voila, so far it works fine. I have not managed to break it so far so for now it's all good, it suffices for development purposes.
User avatar
emu_kidid
Site Admin
Posts: 4927
Joined: Mon Mar 29, 2010 10:06 am
Location: Australia
Contact:

Re: DVD Drive IO voltage

Post by emu_kidid » Tue Dec 30, 2014 2:44 am

Nice work :)
Image
pyroholic
Posts: 58
Joined: Tue Nov 25, 2014 8:22 am

Re: DVD Drive IO voltage

Post by pyroholic » Wed Jan 07, 2015 9:24 pm

Thanks. I have been playing a bit instead of doing development the last couple of days and it seems to work great. I had one crash in the beginning though, so I adjusted the phase alignment so that it is basically centered between the clock edges, kind of the same as hitting the data eye in ddr ram. After that I have seen no issues so it seems promising.

I got myself a cheap japanese cube today so I'm planning to do some testing with that one as well, I did the region mod on it so I can test on each region, don't think it will differ much though. I noticed after removing the heat sink and looking around that the region mod can be done without removing the heat sink at all, there are usable vias on the bottom side of the motherboard as well.
User avatar
megalomaniac
Posts: 2480
Joined: Sun Aug 21, 2011 5:33 am
Location: Drunk in Texas
Contact:

Re: DVD Drive IO voltage

Post by megalomaniac » Thu Jan 08, 2015 12:56 am

pyroholic wrote:I noticed after removing the heat sink and looking around that the region mod can be done without removing the heat sink at all, there are usable vias on the bottom side of the motherboard as well.
you mean these??
http://www.gc-forever.com/wiki/index.ph ... W_IT_WORKS
emu_kidid wrote: beer is like WD40 for megalomaniac's brain, gets the gears moving
>>> BadAssConsoles.com <<<

Image Image Image
master801
Posts: 9
Joined: Fri Apr 27, 2012 11:07 pm

Re: DVD Drive IO voltage

Post by master801 » Thu Jan 08, 2015 3:00 am

I love the idea and how much progress you've gotten with your drive emulator.


In fact, your GC drive emulator project has inspired me to try to learn C to achieve the same goal you are doing as well, however I think I'll either eventually drop the project due to my inexperience with the GameCube and the C language (I'm a Java programmer).

In any-case, I hope me attempting to do that doesn't overstep your boundaries -- I would really hate myself if I made you a tad non-motivated towards the project, or think that I'm trying to steal your idea/project.
pyroholic
Posts: 58
Joined: Tue Nov 25, 2014 8:22 am

Re: DVD Drive IO voltage

Post by pyroholic » Thu Jan 08, 2015 9:38 pm

megalomaniac wrote: you mean these??
http://www.gc-forever.com/wiki/index.ph ... W_IT_WORKS
Yes! those are the ones, specifically the one on the left of the sense line drawn on the picture. The 3.3V is also available to the right of it, just beside the '3' in 173. Whish I had looked around a bit more before doing the mod, but now it's done and works fine. But if I do it again I will use the bottom side of the motherboard.
master801 wrote:I love the idea and how much progress you've gotten with your drive emulator.


In fact, your GC drive emulator project has inspired me to try to learn C to achieve the same goal you are doing as well, however I think I'll either eventually drop the project due to my inexperience with the GameCube and the C language (I'm a Java programmer).

In any-case, I hope me attempting to do that doesn't overstep your boundaries -- I would really hate myself if I made you a tad non-motivated towards the project, or think that I'm trying to steal your idea/project.
Go for it, I can't really say that any of the ideas was mine to begin with except using one chip for multiple purposes, and I wouldn't mind anyway. Regardless if you finish or not you will at least have learned something along the way.
master801
Posts: 9
Joined: Fri Apr 27, 2012 11:07 pm

Re: DVD Drive IO voltage

Post by master801 » Fri Jan 09, 2015 1:26 am

pyroholic wrote:
megalomaniac wrote: -snip-

Go for it, I can't really say that any of the ideas was mine to begin with except using one chip for multiple purposes, and I wouldn't mind anyway. Regardless if you finish or not you will at least have learned something along the way.
Thank you for the go ahead.


I can't wait to see what progress you've made so far, with your projects! *Hype*

EDIT:

I feel like I killed this thread...
pyroholic
Posts: 58
Joined: Tue Nov 25, 2014 8:22 am

Re: DVD Drive IO voltage

Post by pyroholic » Sat Jun 27, 2015 10:00 pm

Wow, it's been a while since I posted here... I kind of lost focus for a while and started biking instead :)

But I have been doing some work this last week. Actually I did some stuff in February too but got side-tracked and never found the time to start again.
What I have done is to migrated from the cyclone v board to a cheap Xilinx Zynq based dev-board which has an on board HDMI transmitter and is small enough to fit inside the cube. Unfortunately the HDMI transmitter is connected as 565-RGB so a bit low color depth but it will do for now. Until last week I had basically only downloaded the sources for linux kernel and bootloader and gotten it running.

Anyway, I have gotten most of the system running pretty well now. The vhdl code for the fpga side was basically compatible, only minor changes towards the cpu interface so i got that building pretty quick. After that I ported the driver and it actually worked pretty much out of the box after fixing some wiring. I also did some updates to the systme so at power-on the cpu programs the fpga with the configuration and then boot the kernel and automatically mounts usb-drives if present. Boot time is about 4.5 seconds without any effort to speed it up. The gamecube seems to patiently wait for the DVD to start streaming data on the condition that the init command has been acknowledged so there is no rush other than getting the fpga programmed which seems to work just fine.

The next step will be to get dma going for faster loading speed and try to get audio streaming up and running.
novenary
Posts: 1754
Joined: Mon Dec 30, 2013 7:50 am

Re: DVD Drive IO voltage

Post by novenary » Sun Jun 28, 2015 8:00 am

Cool to hear progress on this, good luck finishing it !
meneerbeer
Posts: 212
Joined: Wed Sep 03, 2014 9:13 am

Re: DVD Drive IO voltage

Post by meneerbeer » Sun Jun 28, 2015 10:31 am

I am pretty interested in this, mostly for learning.

On websites I read some messages that there used to be source code for a drive emulator available on crazynation.org. That website seems to be down. With waybackmachine I found this. Unfortunately you can not download the files there. Does anyone still have these files?

It would be pretty cool if we can make a cheap drive emulator that is plug and play.
HyperIris
Posts: 37
Joined: Fri Jul 30, 2010 12:58 pm
Location: China
Contact:

Re: DVD Drive IO voltage

Post by HyperIris » Sun Jul 05, 2015 1:00 am

Crazynation‘s design is just a prototype like one.

I've make up another one like this: viewtopic.php?f=31&t=184&p=1137#p1137
Wild Scientist
pyroholic
Posts: 58
Joined: Tue Nov 25, 2014 8:22 am

Re: DVD Drive IO voltage

Post by pyroholic » Tue Jul 07, 2015 12:26 pm

I looked at the crazynation sources a couple of year ago, I think the documentation is a lot more useful for understanding of the drive interface which is actually pretty simple. The code was mostly implementation of an ide interface.

Anyway, I have done some scripting so now I have automated loading of a game after the usb - drive is detected and mounted. So now i can just switch on the power on the gamecube and it powers the SoC which loads a game from the drive. Kind of limited with hardcoded namn of the iso-file bur still pretty neat.
meneerbeer
Posts: 212
Joined: Wed Sep 03, 2014 9:13 am

Re: DVD Drive IO voltage

Post by meneerbeer » Tue Jul 07, 2015 12:55 pm

Cool stuff. I am planning to use a softcore (probably ZPU) and use an SD card for the games. First I will try to use the SD card in SPI mode, without a filesystem. Hopefully that is fast enough.

I have found the crazynation source. It is completely cluttered with IDE code. I think about 70% of the code is controlling the IDE interface. The code also seems to handle only a few commands (which is enough I guess?).

I am wondering about command 0xa8000040 (read Disc ID/Init Drive according to yagcd). If there is a disc inside the gamecube I guess it reads and returns the disc id? What if there is no disc in the gamecube?
pyroholic
Posts: 58
Joined: Tue Nov 25, 2014 8:22 am

Re: DVD Drive IO voltage

Post by pyroholic » Tue Jul 07, 2015 5:32 pm

Sounds cool with the softcore, you don't really need much CPU performance to emulate the drive controller, but you will probably need to shuffle data using DMA or streaming directly to the drive from the SD-controller. If i remember correctly the SD-specification states that SPI can function up to 25 MHz so that might be a bit slow, but should work for testing at least. For basic operation you don't really need many commands implemented, you should be fine with inquiry, init, seek and read. Maybe stop motor also.

I'm not sure what happens if you init the drive without a disc since I have not tested but I think that if you try it sets the error-flag and if you read the error code it will respond with no-disc error code.
novenary
Posts: 1754
Joined: Mon Dec 30, 2013 7:50 am

Re: DVD Drive IO voltage

Post by novenary » Tue Jul 07, 2015 5:58 pm

The specification for SD cards in spi mode is indeed 25MHz but using them at a slightly higher frequency is possible. That's what Swiss does (default it 32MHz mode which is actually 27 for some reason).
I was also thinking of using a softcore for this. The original drive uses an 8bit MCU after all.
pyroholic
Posts: 58
Joined: Tue Nov 25, 2014 8:22 am

Re: DVD Drive IO voltage

Post by pyroholic » Thu Aug 06, 2015 7:29 pm

I have gotten around to doing some more work, not so much development but now the FPGA is nicely installed inside the GameCube with the USB-port, network connector and all neat stuff available from the side. Image

I have soldered some internal wires to memory card slotA so the plan is to add memory card support some time in the future.
So far i have added support for the buttons so i can select game using them, currently very simple. I kind of regret putting a crappy character LCD in there but i have some more cases to modify so i will probably put in a more fun display in the end. I have actually played a lot also and so far no issues so that's nice.
Attachments
20150802_193936.png
(1.77 MiB) Not downloaded yet
Post Reply