Open Source FPGA based GDROM Emulator

Discussion in 'Sega Dreamcast Development and Research' started by madsheep, Aug 11, 2016.

  1. Bad_Ad84

    Bad_Ad84 The Tick

    Joined:
    May 26, 2011
    Messages:
    8,566
    Likes Received:
    1,308
    Last edited: Dec 30, 2016
    TerdFerguson likes this.
  2. Bad_Ad84

    Bad_Ad84 The Tick

    Joined:
    May 26, 2011
    Messages:
    8,566
    Likes Received:
    1,308
    Here is how to program the board from windows:

    (instructions for Windows 10, it may be that older versions of Windows do not automatically install the drivers - make adjustments as required and post here).

    Download the package - https://www.dropbox.com/s/zfpzs2ft2c5jzj5/icestorm.7z?dl=0
    Connect the dev board to your PC and allow the original drivers to install.
    run "zadig_2.2.exe" from within the "bin" folder.
    Goto Options -> List all devices:
    [​IMG]
    from the drop down box, select "Lattice FTUSB Interface cable (Interface 0)"
    [​IMG]
    In the box that currently says "WinUSB", click the down arrow until you see "libusbK".
    [​IMG]
    Click "Replace Driver"

    This should now allow you to connect to the board, to confirm everything is working:

    Open a command prompt and within the bin folder from earlier, run "find_all.exe" and you should see the board detected.
    [​IMG]


    All the prep work is now done, if you need to do updates in future - you can start from this part:

    Now, while within the bin folder, run the command "iceprog.exe gdrom_hw_emulator.bin"

    This will program the dev board with the bitstream.

    [​IMG]
     
    Last edited: Dec 20, 2016
  3. Xerxes3rd

    Xerxes3rd Rapidly Rising Member

    Joined:
    Sep 1, 2016
    Messages:
    96
    Likes Received:
    35
    That's awesome! Can you also use Zadig to restore the original drivers for the board?
     
  4. Bad_Ad84

    Bad_Ad84 The Tick

    Joined:
    May 26, 2011
    Messages:
    8,566
    Likes Received:
    1,308
    Yes, you can restore the original driver too.

    But on Windows you can just remove the driver from device manager and tick the box to delete driver. It will then install the original driver anyway.
     
    Xerxes3rd likes this.
  5. Bad_Ad84

    Bad_Ad84 The Tick

    Joined:
    May 26, 2011
    Messages:
    8,566
    Likes Received:
    1,308
    New version of the conversion tool that supports CDI images. Compiled for windows.
     

    Attached Files:

    Collingall and Xerxes3rd like this.
  6. pr0cess0r

    pr0cess0r Spirited Member

    Joined:
    Oct 22, 2016
    Messages:
    109
    Likes Received:
    8
    I Think it would be a good idea to port this project tho a new FPGA that is available in tqfp packaging and make a custom pcb it would cust less then this dev board. if the everdrive V1 FPGA do the work it would be possible to flash a custom firmware to the everdrive V1 and make an adfapter psc and use it in the dreamcast. It would make great use of those cheap ED clone.
     
  7. Xerxes3rd

    Xerxes3rd Rapidly Rising Member

    Joined:
    Sep 1, 2016
    Messages:
    96
    Likes Received:
    35
    I followed the instructions for replacing the USB driver, but when I run find_all, I get the following:

    Code:
    Number of FTDI devices found: 2
    Checking device: 0
    ftdi_usb_get_strings failed: -4 (libusb_open() failed)
    
    I see the "Lattice FTUSB Interface Cable (Interface 0)" in Device Manager under "libusbK USB Devices." Obviously, iceprog doesn't work either. Any ideas?
     
  8. Bad_Ad84

    Bad_Ad84 The Tick

    Joined:
    May 26, 2011
    Messages:
    8,566
    Likes Received:
    1,308
    Unplug and replug, see what hardware is listed in device manager.

    Try running cmd as administrator and running findall again.

    Could have been my command prompt was already elevated when making guide
     
  9. Xerxes3rd

    Xerxes3rd Rapidly Rising Member

    Joined:
    Sep 1, 2016
    Messages:
    96
    Likes Received:
    35
    Sorry, forgot to mention I tried running the command prompt as admin, and unplugged & replugged. I also then tried replacing the driver for Interface 1 as well, with didn't change anything. I'll try rebooting, then try the procedure on a separate computer and see what happens.

    Edit: Do you have source for find_all.exe?
     
    Last edited: Jan 7, 2017
  10. Xerxes3rd

    Xerxes3rd Rapidly Rising Member

    Joined:
    Sep 1, 2016
    Messages:
    96
    Likes Received:
    35
    Alright, I tried a different USB port, replaced the driver, and it's working. Strange, but at least it works!

    Edit: Well, I can program it, but it doesn't work correctly. LEDs D2, D3, D5, D6, D8 and D9 are steady-on, while D4 and D7 are off. I suspect I bridged the oscillator pads by accident.

    Edit 2: I enabled the internal oscillator instead of the external one, and the LED behave as expected. No images will boot past the SEGA logo, but that's to be expected as well. It looks like I'll have to resolder the crystal. It's too bad that most of the components are through-hole, but that crystal and cap are SMD. =(
     
    Last edited: Jan 7, 2017
  11. Zeigren

    Zeigren Spirited Member

    Joined:
    Jan 19, 2014
    Messages:
    191
    Likes Received:
    124
    I was thinking about playing around with this but I'm curious what progress you guys have made.

    I started looking into various design considerations for if this were to get made into a custom board. @OzOnE do you think the Cyclone 10 LP would be up to the task, especially in conjunction with a microcontroller? I was specifically looking at the 10CL006ZE144I8G or
    10CL010YE144I7G. They're pretty cheap (like $10~) and come in a EQFP package. So the boards could be made at some of the cheaper fabs and would hopefully only need to be 4 layers. Then with a stencil it would be somewhat easier for someone to put one together themselves, vs a bga package.
     
    Last edited: Nov 10, 2017
    Xerxes3rd likes this.
  12. Xerxes3rd

    Xerxes3rd Rapidly Rising Member

    Joined:
    Sep 1, 2016
    Messages:
    96
    Likes Received:
    35
    The one I built seems to be recognized by the Dreamcast, but gets really slow (and then hangs) when I boot up Ooga Booga. Admittedly, I haven't tried any other games with it. It looks like Marcus chose this design because you can build it yourself pretty easily; however, it's not a terribly practical design. It does fit in the Dreamcast case, but having to remove and re-insert the SD card to change images isn't a good long-term solution.

    Moving the microcontroller off the FPGA seems like a good idea. If you pull out the Atmel soft-core, you could probably move the rest of the Verilog code over to an Altera or Xilinx platform pretty easily. At that point you could get a rough idea of FPGA utilization.

    Designing a board that could be fabbed and populated at a cheaper house (with a reasonable expectation of success) would be awesome!
     
    Zeigren likes this.
  13. Zeigren

    Zeigren Spirited Member

    Joined:
    Jan 19, 2014
    Messages:
    191
    Likes Received:
    124
    Ideally we would be able to make some kind of middle ground. A board that could be ordered for relatively cheap, from places like OSHpark or Seeed, and with large enough components that people with decent soldering skills could make at home. Either with some cheap reflow, or very fine soldering. For comparison, from Seeed, just to get ten 10x10cm bare pcbs that could use the ICE40HX8K in a 256-CABGA package would be $300+. Using some FPGA in a *QFP package you could get the same number of boards for $50, and you could easily exceed their minimum board specs. Also would help make the whole design more "future proof", don't have to rely on dev boards being available and people could make one offs for relatively cheap if no one is selling them. Part of the reason I was looking at the Cyclone 10, was since it just came out it might be available for a lot longer than some of the other options.

    That's why I was asking OzOnE, since he already has taken out the Atmel soft-core then I wouldn't need to figure it out :p

    Edit: As a possible mcu contender perhaps something in the AT32UC3A0 line? Unfortunately a bit more expensive and slower then say the SAM3 in the GDEMU, but it has the benefit of being programmable directly over USB with the stock bootloader. You can either just plug a flash drive into it, or you can use dfu-programmer on all OS's. At least on Windows I already have a script/gui(kinda) for dfu-programmer for easy mode. The AT32UC3A3 might be a better choice but I couldn't confirm the ability to update from a flash drive for it.

    Edit 2: Checked the application note on Microchip's website and the UC3A3 does support it, here's the note. Durp, can achieve the same thing with SAM-BA and make it easier by using BOSSA to flash the various SAM chips. :p For clarification in both cases they would need to be programmed over USB first but after that could be programmed via flash drive or some other storage medium. Minor edit for the edit(edit): to work our way further down the line a bunch of the xmega's come with DFU, which can be changed over to a SD boot loader. At least I learned something >.>

    Edit 3: I'm going for a record now <.< I threw together a PCB design squishing the riser and dev board together pretty much, with some part changes and omissions and such. I used a crappy autorouter layout just to see what it would look like and if the clearances would be ok. It would work on a 4 layer board, with 4 mil tracks/spacing, 0.3mm holes(kinda sketchy annular rings), and 0.1mm soldermask dam.

    If you ordered like 10 boards and assembled them yourself they could each cost "$60", but that's not including shipping, taxes, stencils, consumables or anything. Just cost per board and parts. So not that great in comparison to buying the dev board and riser. It could look "nicer" though.

    However after changing the BOM to use as many of Seeeeeds OPL parts as I could, having them assemble the boards can yield a much better deal, well as long as you get more than like 50. Then each board would actually cost like $60, with no assembly required. Of course then you need like $3k to plop down to get all of those, and that doesn't include any kind of real testing or anything. At that point you can spring for 6 layers and ENIG and it doesn't change the price much.

    So yeah, currently a fully custom PCB only makes sense with either a large upfront cost or with a significant design change. As long as you only care about $$$ and not looks that is. Unless the dual board setup or some of the design choices are the cause of any problems. I don't think any of the track lengths even with the dual board setup are long enough to be that much of a problem, the only thing that seems like it could be problematic to me is having the second oscillator on the riser board.
     
    Last edited: Nov 14, 2017
  14. minnieman

    minnieman Member

    Joined:
    Oct 2, 2016
    Messages:
    17
    Likes Received:
    2
    Resurrecting this thread from the grave because I desperately need help.

    I got 10 riser boards fabbed and went ahead and built it, flashed @Bad_Ad84 gdrom_hw_emulator.bin with no errors but the dreamcast seems to not detect the riser/fpga as a drive. When it is powered on, the leds D4-D7 stay constant red while D2, D3, D8, D9 are dimly lit. I compared the results of what I am getting to what the dreamcast does when no GD-ROM is installed and it is the same behavior... Boots to the dreamcast bios logo with no animation, hangs for 30sec-1min then just goes to the main menu.

    Is it possible my I flashed an incorrect/corrupted bin? I don't have the suggested micro sd, would that make a difference? I currently have a micro SD lot wired for SPI interface but maybe I made a mistake. I ordered the recommended module so maybe that might solve an issue but at this point I am at a total loss...

    Probably have spent 10+ hours trouble shooting so ANY help would be VERY much appreciated! Hell, if you help me get this device working I would be willing to donate! I am that desperate!
     
  15. TriMesh

    TriMesh Site Supporter 2013-2017

    Joined:
    Jul 3, 2008
    Messages:
    2,324
    Likes Received:
    750
    That sounds very much like the behavior I was seeing when I tried to build the bitstream using the wrong version of yosys - if you're not getting any sound, it might be worth checking if the oscillator is installed correctly.
     
    minnieman likes this.
  16. minnieman

    minnieman Member

    Joined:
    Oct 2, 2016
    Messages:
    17
    Likes Received:
    2
    Thank you for your response! Do you happen to have the bitstream you built handy? Honestly, I tried building it under your recommendations in ubuntu but I am too much of a noob to build it all myself. Spent a few hours there learning about makefiles! Alas, no dice.

    EDIT: Sound is good, oscillator is worked vv good.
     
  17. Xerxes3rd

    Xerxes3rd Rapidly Rising Member

    Joined:
    Sep 1, 2016
    Messages:
    96
    Likes Received:
    35
    I’ll look and see if I still have the bitstream hanging around somewhere. I remember having to compile the toolchains from source since packages didn’t exist for the correct versions (welcome to Linux). Regarding your SD adapter, if you leave the card out of it, the system should act like there’s no disc. Be sure that you’re also using a VA1 Dreamcast; the board isn’t compatible with VA0 or VA2. I assume also that you have the USB cable plugged between the boards so that the FPGA board is getting 5V.
     
    minnieman likes this.
  18. TriMesh

    TriMesh Site Supporter 2013-2017

    Joined:
    Jul 3, 2008
    Messages:
    2,324
    Likes Received:
    750
    OK, I just built this and I think it's working - but I can't actually get any games to boot.

    At the least, you should get the LEDs running with no SD card inserted and the SEGA splash screen.

    I will carry on trying to get it working and let you know.
     

    Attached Files:

    minnieman likes this.
  19. minnieman

    minnieman Member

    Joined:
    Oct 2, 2016
    Messages:
    17
    Likes Received:
    2
    Thank you @Xerxes3rd and @TriMesh ! The SD FPGA acted the same whether a card was inserted or out, either my wiring is bad or its the programming of the FPGA... I'm suspecting the latter. I'm using a va1 board and using the usb power to power the FPGA.

    @TriMesh I'll give your bitstream a shot when I get into my office and report back with my findings, thank you!!!
     
  20. TriMesh

    TriMesh Site Supporter 2013-2017

    Joined:
    Jul 3, 2008
    Messages:
    2,324
    Likes Received:
    750
    OK, I just downloaded the latest version from github and built that - this one seemed to be getting a bit further than the other (I.E. it got to the "Press Start" screen) even if it's still painfully slow.

    See if this does anything for you....
     

    Attached Files:

    minnieman likes this.
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page