Shop Learn
P2 Edge PSRAM is working - Page 3 — Parallax Forums

P2 Edge PSRAM is working

13»

Comments

  • hinvhinv Posts: 1,067

    @cgracey said:

    @rogloh said:

    @rogloh said:

    @cgracey said:
    ... I kind of think it might be useful to have such a thing. 32MB can accommodate such stuff nicely.

    Yeah nothing stopping a nice hires GUI being developed for the P2 for those applications that can benefit from one.

    One thing I'm still hoping for Chip, is for your SPIN 2 compiler to eliminate uncalled methods (dead code) from the binary image. That would allow larger "libraries" of graphics and GUI methods to be developed that won't have to bloat the client using them when the included routines are not called. FlexSpin can do this but official SPIN2 still can't AFAIK, unless you changed it recently.

    No, it doesn't remove dead code. Not sure when I'll get there. That almost needs another compiler approach.

    Maybe you should do it when you port your SPIN2 compiler to the P2, now that there is a decent amount of ram.

  • hinvhinv Posts: 1,067
    edited 2022-01-03 13:20

    @rogloh said:
    This is what you can do with it now in 1080p 8bpp.

    Looks like a good example to start with for lots of projects.

  • roglohrogloh Posts: 3,794
    edited 2022-01-03 07:58

    @hinv said:

    @rogloh said:
    This is what you can do with it now in 1080p 8bpp.

    Is that demo published in your code with the drivers? Looks like a good example to start with for lots of projects.
    Good Job!

    Thanks, yes is it supplied with the drivers. I'm also experimenting with speeding up the text rendering stuff too. I think I just found a way to speed it up ~100x by writing to hub first one line of text at a time then doing a graphics copy.

  • @rogloh said:
    Try this alternate timing for RES_1024x768 to see it it helps you.

    Yes, that solved it.
    Let me just say how great this driver package is.
    Easy fiddling with screen timings, display regions and the memory functions make life so easy.
    Using the "video" ram for other stuff without corrupting the display.... great
    Now testing write/read(byte) functions with SRAM at various resolutions. P2@216Mhz -RES_1280x1024 still leaves a little bandwidth to do reads and writes to the sram :-)
    Not much spare bandwidth is left at that resolution but its is still so much more than I could have hoped for!
    And one could just hook up a second ram device if neccesary - very flexible :smile:

  • roglohrogloh Posts: 3,794
    edited 2022-01-03 14:58

    Yeah I like to keep things very flexible and fully featured, though packing everything into the space available often comes at the expense of more internal coding complexity making the code a bit tricky to decipher. My PASM2 drivers are probably not something for a new P2 user to easily learn from, but more to just use without knowing all the hidden details of how it works inside. I'm also still trying to wrap simpler SPIN2 APIs around them in more convenient ways....

    When it comes to memory bandwidth if you probe the bus signals on a scope, specifically the memory CS pin and HSYNC pin, you will see the amount of memory bandwidth/time that the different video modes use and how much free time you get per scan line for all other lower priority requests, as well as the effect of the burst sizes and any resulting fragmented transfers. 1280x1024 is probably pushing things with the stock timing at 216MHz, but you could try to experiment with slightly higher P2 frequencies and more blanking if your monitor timing is flexible and you want more write bandwidth. Lower bit depths obviously help too.

    Multiple devices on multiple buses are intended to work in this design...with concurrent requests on different buses. I'm still to really test that part out but it should work in theory. I should try it with my HyperRAM and PSRAM boards in a P2-EVAL sometime. Also Tubular mentioned trying out multiple display outputs sharing the same bank of external memory - and that might work too, assuming the same P2 clock frequency on each VGA and sufficient read/write bandwidth (ie. lower resolutions/bit depths). I think it would be best if the horizontal line frequencies remained in sync in that case so the requests responses were more deterministic.

  • roglohrogloh Posts: 3,794

    @rogloh said:
    Also Tubular mentioned trying out multiple display outputs sharing the same bank of external memory - and that might work too, assuming the same P2 clock frequency on each VGA and sufficient read/write bandwidth

    I just tried this... and I'm now outputting video to both DVI and VGA on different ports from same PSRAM external frame buffer source and it appears to be working with a lot of write bandwidth left! :smile: This was tested with 640x480x8bpp and also 800x480x8bpp. Higher resolutions will push it harder but I don't have a twin VGA setup yet (needs some soldering of a board Tubular provided) such that I can output higher than VGA resolution yet. DVI is not syncing at 800x600x60Hz over DVI on my monitor as the dotclock is too high for the P2 TMDS output timing.

  • roglohrogloh Posts: 3,794
    edited 2022-01-04 11:50

    Here's a short (<2MB) video of the external RAM graphics demo now running on both screens.
    The P2 Edge PSRAM is servicing two video COG requests per scan line, plus writing into the frame buffer from the lower priority COGs. Resolution here was 800x480x8bpp.

  • TubularTubular Posts: 4,436

    Wow, nice demo! Great to prove that is possible. Its useful that you tested 1 vga + 1 dvi as well.

    Now to think of something to do with it... i guess stereo vision applications? Folding e-reader?

  • pik33pik33 Posts: 1,226

    I discovered I have 2 types of these chips. "R" (these are the same as in P2 Edge 32MB) and (more of) "N". N cannot do bursts more than 1k...

  • I look forward to test this myself 👍

  • evanhevanh Posts: 12,230

    @rogloh said:
    ... DVI is not syncing at 800x600x60Hz over DVI on my monitor as the dotclock is too high for the P2 TMDS output timing.

    dvi60_800x600_timing    ' 60 Hz with 33.0 MHz pixel clock
                long   CLK330MHz
                long   330_000_000
                       '_HSyncPolarity___FrontPorch__SyncWidth___BackPorch__Columns
                       '     1 bit        7 bits      8 bits      8 bits    8 bits
                long   (SYNC_NEG<<31) | ( 8<<24) | ( 64<<16) | ( 8<<8 ) | (800/8)
    
                       '_VSyncPolarity___FrontPorch__SyncWidth___BackPorch__Visible
                       '     1 bit       8 bits      3 bits     9 bits   11 bits
                long   (SYNC_NEG<<31) | (1<<23) | (  2<<20) | ( 22<<11) | 600
                long   10 << 8     ' sys-clock to pixel-clock ratio
                long   0
                long   0   ' reserved for CFRQ parameter
    
  • roglohrogloh Posts: 3,794

    @Tubular said:
    Wow, nice demo! Great to prove that is possible. Its useful that you tested 1 vga + 1 dvi as well.

    Now to think of something to do with it... i guess stereo vision applications? Folding e-reader?

    Yeah your idea worked nicely Lachlan. Glad you suggested to try it out.

    @evanh said:

    dvi60_800x600_timing    ' 60 Hz with 33.0 MHz pixel clock
                long   CLK330MHz
                long   330_000_000
                       '_HSyncPolarity___FrontPorch__SyncWidth___BackPorch__Columns
                       '     1 bit        7 bits      8 bits      8 bits    8 bits
                long   (SYNC_NEG<<31) | ( 8<<24) | ( 64<<16) | ( 8<<8 ) | (800/8)
    
                       '_VSyncPolarity___FrontPorch__SyncWidth___BackPorch__Visible
                       '     1 bit       8 bits      3 bits     9 bits   11 bits
                long   (SYNC_NEG<<31) | (1<<23) | (  2<<20) | ( 22<<11) | 600
                long   10 << 8     ' sys-clock to pixel-clock ratio
                long   0
                long   0   ' reserved for CFRQ parameter
    

    Works on the LCD panel, though the CRT doesn't like it too much. I do get an image there but the blanking seems a bit too low for it and there are some retrace artifacts. It would work fine on a twin LCD setup over DVI I suspect.

  • evanhevanh Posts: 12,230
    edited 2022-01-05 02:00

    Hehe, yeah, fully reduced h-blanking. Only intended for digital links like DVI/HDMI.

  • Wuerfel_21Wuerfel_21 Posts: 2,170
    edited 2022-01-05 21:59

    Here's a simple script I've written to fill PSRAM with a file:

    loadit.rb:

    COMPORT = 'COM7'
    SLICE_SIZE = 256*1024
    
    require 'tempfile'
    
    `flexspin -2 psram_loadit.spin2`
    
    raise "Need exactly one argument" if ARGV.size != 1
    
    thefile = File.binread(ARGV[0])
    
    totalslices = ((thefile.size-1)/SLICE_SIZE)+1
    
    i = 0
    until thefile.empty?
        puts "Loading slice #{i}..."
        tmp = Tempfile.new("loadit", binmode: true)
        tmp.write(i.chr)
        tmp.write(totalslices.chr)
        tmp.write(thefile.slice!(0...SLICE_SIZE).ljust(SLICE_SIZE,?\0))
        tmp.close
        `loadp2 -p #{COMPORT} @0=psram_loadit.binary,@7FFE=#{tmp.path} -e "recv(E)"`
        tmp.unlink
        i+=1
    end
    

    psram_loadit.spin2:

    CON
    _CLKFREQ = 300_000_000
    _STACK = 128
    _FREE = ((512-32)*1024)/4 + 1
    
    SLICE_MAX = (32*1024*1024)/(256*1024)
    
    OBJ ram:"psram"
    PUB main() | slice, total
    
    slice:= byte[$7FFE]
    total:= byte[$7FFF]
    
    ram.start()
    repeat
      ram.write($8000,slice*(256*1024),256*1024)
    while (slice+=total)<SLICE_MAX
    
    _tx("E")
    repeat
    
  • roglohrogloh Posts: 3,794

    Great, looks handy.

  • roglohrogloh Posts: 3,794
    edited 2022-01-06 04:52

    I just used Wuerfel's ruby download tool above and loaded a 1024x768 truecolour image into the PSRAM framebuffer for output with my video driver. This is probably somewhere around the highest (common) resolution possible with truecolour and external memory bandwidth available (at 60Hz). It worked. Ignore the banding video artefact at the top due to photographing the CRT. Earlier I did see one time when a single downloaded slice seemed to be corrupted so not sure what happened there if it failed to download that portion (the download might have timed out, script doesn't stop on failure).

    Edge is pretty warm to hold, P2 running at 325MHz..three cogs active (one in an empty repeat loop).

  • pik33pik33 Posts: 1,226
    edited 2022-01-06 15:13

    Amiga type HAM is worth to consider in such environment. I t can give a lot of colors while still being 8bpp.

  • roglohrogloh Posts: 3,794
    edited 2022-01-07 11:21

    Just managed to push the truecolour framebuffer output out at 1280x720@60Hz to a CRT via VGA. That works too and is more pixels than 1024x768 so I was incorrect above. Not going to be a huge amount of write bandwidth left with that but it does work and could be rather useful for slideshows etc. It runs at 297MHz.

    I also tried 1080i60 but (for integer pixel clock ratios) I think it needs to run the P2 at 371.25MHz which is a bit too high (even though it worked!). 1080i50 should be achievable with truecolour output at more reasonable P2 clock speed. I need to dig up the official 1080i50 timing to test that one out properly.

  • VonSzarvasVonSzarvas Posts: 2,562
    edited 2022-01-07 15:09

    @rogloh said:
    Just managed to push the truecolour framebuffer output out at 1280x720@60Hz to a CRT via VGA. That works too and is more pixels than 1024x768 so I was incorrect above. Not going to be a huge amount of write bandwidth left with that but it does work and could be rather useful for slideshows etc. It runs at 297MHz.

    I also tried 1080i60 but (for integer pixel clock ratios) I think it needs to run the P2 at 371.25MHz which is a bit too high (even though it worked!). 1080i50 should be achievable with truecolour output at more reasonable P2 clock speed. I need to dig up the official 1080i50 timing to test that one out properly.

    Interestingly... One of the manufacturing tests for the modules runs them at 370MHz, but I'd expect the modules to get warm/hot over time at that level of overclocking (depending on the power demands of users code).
    Probably would be good to have a fan or heatsink to control the temperature rise of the module when the user code is pushing things at such limits! At least for long term use.
    I was thinking of @CJMJ 3D printed module holder... maybe that could have a small fan attached to the back for overclocking experiments in a convenient form factor....

  • Oh, @VonSzarvas, I almost forgot: The Edge product guide has the PSRAM clock and select pins swapped around.

  • @Wuerfel_21 said:
    Oh, @VonSzarvas, I almost forgot: The Edge product guide has the PSRAM clock and select pins swapped around.

    Fix queued for deployment. Thank you very much.

  • pik33pik33 Posts: 1,226
    edited 2022-01-08 08:38

    Probably would be good to have a fan or heatsink to control the temperature rise of the module when the user code is pushing things at such limits! At least for long term use.
    I was thinking of @CJMJ 3D printed module holder... maybe that could have a small fan attached to the back for overclocking experiments in a convenient form factor....

    Preparing parts for the project :) A 3D printed holder. A heatsink :)

  • Cool!

Sign In or Register to comment.