Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. Let's make a Pi Pico 2 powered video card.

Let's make a Pi Pico 2 powered video card.

Scheduled Pinned Locked Moved Uncategorized
retrocomputing
144 Posts 30 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

    Okay, lets see if I can get a 14.31818MHz clock out of this thing.

    We have a 50MHz clock source, on a pin called FPGA_CLK1_50.

    How do we get 14.31818MHz out of that?

    By attaching a PLL to it, hopefully.

    module de10_clock_test (
    input wire FPGA_CLK1_50,
    output wire GPIO_1_0
    );

    wire clk_osc;
    wire pll_locked;

    cga_pll pll_inst (
    .refclk (FPGA_CLK1_50),
    .rst (1'b0),
    .outclk_0 (clk_osc),
    .locked (pll_locked)
    );

    assign GPIO_1_0 = clk_osc;
    endmodule
    gloriouscow@oldbytes.spaceG This user is from outside of this forum
    gloriouscow@oldbytes.spaceG This user is from outside of this forum
    gloriouscow@oldbytes.space
    wrote last edited by
    #95

    pll_inst is a PLL instantiation. But notice it says nothing about like dividers or anything. We have to go into something confusingly called the IP (Incendiary Pickle) Catalog to actually configure the PLL.

    This is far as a I get because doing this causes Quartus to hang.

    gloriouscow@oldbytes.spaceG 1 Reply Last reply
    0
    • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

      pll_inst is a PLL instantiation. But notice it says nothing about like dividers or anything. We have to go into something confusingly called the IP (Incendiary Pickle) Catalog to actually configure the PLL.

      This is far as a I get because doing this causes Quartus to hang.

      gloriouscow@oldbytes.spaceG This user is from outside of this forum
      gloriouscow@oldbytes.spaceG This user is from outside of this forum
      gloriouscow@oldbytes.space
      wrote last edited by
      #96

      Oh wait I just had to wait seventeen minutes. cool.

      Link Preview Image
      gloriouscow@oldbytes.spaceG 1 Reply Last reply
      0
      • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

        Oh wait I just had to wait seventeen minutes. cool.

        Link Preview Image
        gloriouscow@oldbytes.spaceG This user is from outside of this forum
        gloriouscow@oldbytes.spaceG This user is from outside of this forum
        gloriouscow@oldbytes.space
        wrote last edited by
        #97

        i bet there are people reading this that know how to actually use this stuff and are having themselves a sensible chuckle at my expense

        gloriouscow@oldbytes.spaceG 1 Reply Last reply
        0
        • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

          i bet there are people reading this that know how to actually use this stuff and are having themselves a sensible chuckle at my expense

          gloriouscow@oldbytes.spaceG This user is from outside of this forum
          gloriouscow@oldbytes.spaceG This user is from outside of this forum
          gloriouscow@oldbytes.space
          wrote last edited by
          #98

          when you build the PLL you get a QIP file full of nonsense

          Link Preview Image
          gloriouscow@oldbytes.spaceG 1 Reply Last reply
          0
          • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

            when you build the PLL you get a QIP file full of nonsense

            Link Preview Image
            gloriouscow@oldbytes.spaceG This user is from outside of this forum
            gloriouscow@oldbytes.spaceG This user is from outside of this forum
            gloriouscow@oldbytes.space
            wrote last edited by
            #99

            Okay, if I did all this right, i should have a 14.31818MHz clock on GPIO pin 1.

            Let's find out! To the workbench!

            gloriouscow@oldbytes.spaceG 1 Reply Last reply
            0
            • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

              @bytex64 just out of curiosity what's the derivation of that how how did you drive it with a pico?

              bytex64@awesome.gardenB This user is from outside of this forum
              bytex64@awesome.gardenB This user is from outside of this forum
              bytex64@awesome.garden
              wrote last edited by
              #100

              @gloriouscow IIRC it’s the regular fractional divider PWM mode but it was a while ago. I do have the source for it: https://github.com/bytex64/tt-munch/tree/main/clockgen

              It’s also not super exact. IIRC the closest it could get was like 25.150 or something.

              1 Reply Last reply
              0
              • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

                Right. This isn't completely baffling or anything

                isabel@chaos.socialI This user is from outside of this forum
                isabel@chaos.socialI This user is from outside of this forum
                isabel@chaos.social
                wrote last edited by
                #101

                @gloriouscow you won minesweeper!

                1 Reply Last reply
                0
                • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

                  Okay, if I did all this right, i should have a 14.31818MHz clock on GPIO pin 1.

                  Let's find out! To the workbench!

                  gloriouscow@oldbytes.spaceG This user is from outside of this forum
                  gloriouscow@oldbytes.spaceG This user is from outside of this forum
                  gloriouscow@oldbytes.space
                  wrote last edited by
                  #102

                  Hot damn!

                  looks just like the Pico clock - maybe it is my probe, lol.

                  So, the cool thing about FPGAs, is that this clock signal now just ... lives inside the vast and mysterious gate goo within the chip. We connected it to GPIO1, but we can connect it to just about anything, internally or externally, and we can trigger other logic on it.

                  It's like real legit design shit. It makes the Pico's PIO mode feel like a bit of a toy.

                  Link Preview Image
                  gloriouscow@oldbytes.spaceG 1 Reply Last reply
                  0
                  • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

                    Hot damn!

                    looks just like the Pico clock - maybe it is my probe, lol.

                    So, the cool thing about FPGAs, is that this clock signal now just ... lives inside the vast and mysterious gate goo within the chip. We connected it to GPIO1, but we can connect it to just about anything, internally or externally, and we can trigger other logic on it.

                    It's like real legit design shit. It makes the Pico's PIO mode feel like a bit of a toy.

                    Link Preview Image
                    gloriouscow@oldbytes.spaceG This user is from outside of this forum
                    gloriouscow@oldbytes.spaceG This user is from outside of this forum
                    gloriouscow@oldbytes.space
                    wrote last edited by
                    #103

                    So remember that digital logic simulation I made of the CGA card in Digital?

                    Digital can export your entire simulation to Verilog.

                    In theory, I just need to wire up the OSC pin to this 14.31818Mhz PLL clock, and wire the simulation's output pins to some GPIOs, route them out through a 244, and I'll have a picture on screen.

                    surely it can't be that simple?

                    gloriouscow@oldbytes.spaceG 1 Reply Last reply
                    0
                    • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

                      I'm starting to think a pico is not the appropriate thing to build a video card with.

                      all my fun ideas always end up with me concluding i should use an FPGA.

                      FPGAs are like the crabs of electronics projects. everything wants to turn into an FPGA if you give it enough time.

                      arclight@oldbytes.spaceA This user is from outside of this forum
                      arclight@oldbytes.spaceA This user is from outside of this forum
                      arclight@oldbytes.space
                      wrote last edited by
                      #104

                      @gloriouscow They also walk sideways really fast!

                      1 Reply Last reply
                      0
                      • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

                        So remember that digital logic simulation I made of the CGA card in Digital?

                        Digital can export your entire simulation to Verilog.

                        In theory, I just need to wire up the OSC pin to this 14.31818Mhz PLL clock, and wire the simulation's output pins to some GPIOs, route them out through a 244, and I'll have a picture on screen.

                        surely it can't be that simple?

                        gloriouscow@oldbytes.spaceG This user is from outside of this forum
                        gloriouscow@oldbytes.spaceG This user is from outside of this forum
                        gloriouscow@oldbytes.space
                        wrote last edited by
                        #105

                        that would be a neat party trick but i wouldn't really learn anything and i'm sure the resulting Verilog would be spaghetti.

                        let's actually build this thing intentionally. Generating a clock was fun but i'm actually going to let the Pico continue to do that, and we'll treat a GPIO on the FPGA as the OSC input pin.

                        We'll divide it by 8, feed it to my Verilog MC6845 pre-configured for 80-column text mode, and wire up the HSYNC and VSYNC outputs to two more GPIOs.

                        We should get a 15.7kHz HSYNC and a 59.9kHz VSYNC out of that.

                        gloriouscow@oldbytes.spaceG 1 Reply Last reply
                        0
                        • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

                          that would be a neat party trick but i wouldn't really learn anything and i'm sure the resulting Verilog would be spaghetti.

                          let's actually build this thing intentionally. Generating a clock was fun but i'm actually going to let the Pico continue to do that, and we'll treat a GPIO on the FPGA as the OSC input pin.

                          We'll divide it by 8, feed it to my Verilog MC6845 pre-configured for 80-column text mode, and wire up the HSYNC and VSYNC outputs to two more GPIOs.

                          We should get a 15.7kHz HSYNC and a 59.9kHz VSYNC out of that.

                          gloriouscow@oldbytes.spaceG This user is from outside of this forum
                          gloriouscow@oldbytes.spaceG This user is from outside of this forum
                          gloriouscow@oldbytes.space
                          wrote last edited by
                          #106

                          This is incredibly cool.

                          This is a spot-on, 15.7kHz horizontal sync pulse generated the Cyclone V FPGA running my (very simplified) Motorola 6845 Verilog implementation!

                          Link Preview Image
                          gloriouscow@oldbytes.spaceG 1 Reply Last reply
                          0
                          • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

                            This is incredibly cool.

                            This is a spot-on, 15.7kHz horizontal sync pulse generated the Cyclone V FPGA running my (very simplified) Motorola 6845 Verilog implementation!

                            Link Preview Image
                            gloriouscow@oldbytes.spaceG This user is from outside of this forum
                            gloriouscow@oldbytes.spaceG This user is from outside of this forum
                            gloriouscow@oldbytes.space
                            wrote last edited by
                            #107

                            The DE-10 Nano has four user switches. The CGA outputs 4 bit color. Very convenient. Since I don't have any video memory yet, I'm just going to assign each switch to a color component, and AND it with display enable from the 6845. This should give us a well defined display rectangle on screen.

                            That looks something like this

                                wire display_en = crtc_de;

                            assign CGA_R = display_en ? SW[0] : 1'b0;
                            assign CGA_G = display_en ? SW[1] : 1'b0;
                            assign CGA_B = display_en ? SW[2] : 1'b0;
                            assign CGA_I = display_en ? SW[3] : 1'b0;
                            gloriouscow@oldbytes.spaceG 1 Reply Last reply
                            0
                            • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

                              The DE-10 Nano has four user switches. The CGA outputs 4 bit color. Very convenient. Since I don't have any video memory yet, I'm just going to assign each switch to a color component, and AND it with display enable from the 6845. This should give us a well defined display rectangle on screen.

                              That looks something like this

                                  wire display_en = crtc_de;

                              assign CGA_R = display_en ? SW[0] : 1'b0;
                              assign CGA_G = display_en ? SW[1] : 1'b0;
                              assign CGA_B = display_en ? SW[2] : 1'b0;
                              assign CGA_I = display_en ? SW[3] : 1'b0;
                              gloriouscow@oldbytes.spaceG This user is from outside of this forum
                              gloriouscow@oldbytes.spaceG This user is from outside of this forum
                              gloriouscow@oldbytes.space
                              wrote last edited by
                              #108

                              Well, it took me a bit to figure out that the 47pF capacitors right at the D-SUB connector are not optional, specifically on HSYNC. This explains why the RGB2HDMI would sync to things the real monitor wouldn't.

                              But hey look, FPGA CGA video!

                              gloriouscow@oldbytes.spaceG 1 Reply Last reply
                              0
                              • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

                                Well, it took me a bit to figure out that the 47pF capacitors right at the D-SUB connector are not optional, specifically on HSYNC. This explains why the RGB2HDMI would sync to things the real monitor wouldn't.

                                But hey look, FPGA CGA video!

                                gloriouscow@oldbytes.spaceG This user is from outside of this forum
                                gloriouscow@oldbytes.spaceG This user is from outside of this forum
                                gloriouscow@oldbytes.space
                                wrote last edited by
                                #109

                                I didn't properly reset the green switch which is why we got cyan instead of blue. lol. But they do all work.

                                The FPGA is being fed the 14.31818 clock from the Pico to simulate the ISA bus' OSC pin as an input to some future card. I'm going simulate the ISA bus with Picos until I have some idea how I'm going to connect all this business to an actual PC's ISA bus.

                                gloriouscow@oldbytes.spaceG 1 Reply Last reply
                                0
                                • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

                                  I didn't properly reset the green switch which is why we got cyan instead of blue. lol. But they do all work.

                                  The FPGA is being fed the 14.31818 clock from the Pico to simulate the ISA bus' OSC pin as an input to some future card. I'm going simulate the ISA bus with Picos until I have some idea how I'm going to connect all this business to an actual PC's ISA bus.

                                  gloriouscow@oldbytes.spaceG This user is from outside of this forum
                                  gloriouscow@oldbytes.spaceG This user is from outside of this forum
                                  gloriouscow@oldbytes.space
                                  wrote last edited by
                                  #110

                                  It's a bit silly to talk about building an FPGA-based CGA card without mentioning the Graphics Gremlin, by @tubetime

                                  https://github.com/schlae/graphics-gremlin

                                  He's already made such a thing.

                                  I'm interested in writing my own Verilog implementation, and of course I want to stick a Pico 2 W on it so we can stream video to it, but it seems sensible to fork the Gremlin instead of re-inventing the entire wheel.

                                  gloriouscow@oldbytes.spaceG 1 Reply Last reply
                                  0
                                  • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

                                    It's a bit silly to talk about building an FPGA-based CGA card without mentioning the Graphics Gremlin, by @tubetime

                                    https://github.com/schlae/graphics-gremlin

                                    He's already made such a thing.

                                    I'm interested in writing my own Verilog implementation, and of course I want to stick a Pico 2 W on it so we can stream video to it, but it seems sensible to fork the Gremlin instead of re-inventing the entire wheel.

                                    gloriouscow@oldbytes.spaceG This user is from outside of this forum
                                    gloriouscow@oldbytes.spaceG This user is from outside of this forum
                                    gloriouscow@oldbytes.space
                                    wrote last edited by
                                    #111

                                    @tubetime

                                    There are some downsides, apparently this is a somewhat expensive card to build, just looking through forum discussions. But it's been five years, maybe there are better/cheaper FPGA options available today?

                                    gloriouscow@oldbytes.spaceG 1 Reply Last reply
                                    0
                                    • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

                                      @tubetime

                                      There are some downsides, apparently this is a somewhat expensive card to build, just looking through forum discussions. But it's been five years, maybe there are better/cheaper FPGA options available today?

                                      gloriouscow@oldbytes.spaceG This user is from outside of this forum
                                      gloriouscow@oldbytes.spaceG This user is from outside of this forum
                                      gloriouscow@oldbytes.space
                                      wrote last edited by
                                      #112

                                      The Gremlin uses a Lattice iCE40 HX FPGA that costs about $20. That's not outrageous.

                                      It has 7680 LUTs.

                                      The Cyclone V I'm using has 110,000, but then again this FPGA is massive overkill. It can emulate a Nintendo 64, after all.

                                      gloriouscow@oldbytes.spaceG 1 Reply Last reply
                                      0
                                      • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

                                        The Gremlin uses a Lattice iCE40 HX FPGA that costs about $20. That's not outrageous.

                                        It has 7680 LUTs.

                                        The Cyclone V I'm using has 110,000, but then again this FPGA is massive overkill. It can emulate a Nintendo 64, after all.

                                        gloriouscow@oldbytes.spaceG This user is from outside of this forum
                                        gloriouscow@oldbytes.spaceG This user is from outside of this forum
                                        gloriouscow@oldbytes.space
                                        wrote last edited by
                                        #113

                                        A lot has changed in the last 5 years since the Gremlin was specc'd out.

                                        This is a Tang Nano 9k. It's about $22 on AliExpress.

                                        It has 8640 LUTs, onboard SPI flash, and an HDMI port (!)

                                        It could be socketed so you could take it out and use it for something else if you got bored with your ISA GlyphBlaster.

                                        Link Preview Image
                                        gloriouscow@oldbytes.spaceG 1 Reply Last reply
                                        0
                                        • gloriouscow@oldbytes.spaceG gloriouscow@oldbytes.space

                                          A lot has changed in the last 5 years since the Gremlin was specc'd out.

                                          This is a Tang Nano 9k. It's about $22 on AliExpress.

                                          It has 8640 LUTs, onboard SPI flash, and an HDMI port (!)

                                          It could be socketed so you could take it out and use it for something else if you got bored with your ISA GlyphBlaster.

                                          Link Preview Image
                                          gloriouscow@oldbytes.spaceG This user is from outside of this forum
                                          gloriouscow@oldbytes.spaceG This user is from outside of this forum
                                          gloriouscow@oldbytes.space
                                          wrote last edited by
                                          #114

                                          There's even a Tang Nano 20K now that has 8MB (yes MB) of SRAM on-board, and an SD-card reader. It's $45.

                                          That's like your whole ass GlyphBlaster right there, just add bus buffers and a de-9 port.

                                          gloriouscow@oldbytes.spaceG 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups