Shop OBEX P1 Docs P2 Docs Learn Events
Exmem_mini.spin2 testing - Page 2 — Parallax Forums

Exmem_mini.spin2 testing

2»

Comments

  • roglohrogloh Posts: 6,054
    edited 2025-09-27 01:39

    I think that's probably it. That would have been the first (and only) real 8 bit mode board as a target. And the chip select pattern or clock speed may have been tied somehow in that driver, assuming lots of fanout load due to having 6 banks of 16MB. As a sanity test you could try my 8 bit driver with your code on a P2Edge and only use half the data pins. You may still need to tweak the clock timing delay of course.

  • No, it's something about how the transfers are chunked up, bad leftover code from the 16-bit driver or smth.

  • RaymanRayman Posts: 15,695

    Testing with SWaP's hyperram now... Can't find a setting that works... Missing something?

    Trying things like this:

    'Config for SWaP Module (hyperram)
    exmem : "exmem_mini" | HYPER_DELAY = 12, MEMORY_TYPE = "H", HYPER_CLK = 47, HYPER_SELECT = 46, HYPER_BASE = 48, HYPER_RWDS = 56, HYPER_RESET = -1, HYPER_LATENCY = 7, HYPER_SYNC_CLOCK = false
    

    These are settings from MegaYume that work...

    HYPER_CLK    = 47' 8+HYPER_ACCESSORY
    HYPER_RWDS   = 56'10+HYPER_ACCESSORY
    HYPER_SELECT = 46'12+HYPER_ACCESSORY
    HYPER_BASE   = 48' 0+HYPER_ACCESSORY
    HYPER_RESET  = -1'15+HYPER_ACCESSORY
    
    HYPER_LATENCY = 7'6
    HYPER_WAIT  = HYPER_LATENCY*4 - 2
    HYPER_DELAY = 12   'scan starting from 11
    HYPER_SYNC_CLOCK = false
    HYPER_SYNC_DATA = false
    

    Just realized might have to play with clock freq...

  • RaymanRayman Posts: 15,695

    Think found the problem in ExMem_mini...
    Seems the latency is hard coded to 6 whereas this module needs 7:

    exmem_banks[16+i] := HYPER_SELECT+i + HYPER_CLK<<8 + HYPER_RWDS<<16 + 7<<25 '6<<25 ' Latency????

  • RaymanRayman Posts: 15,695
    edited 2025-09-27 14:39

    Added a "HYPER_LATENCY" constant to exmem_mini and have the code above use that instead.
    Seems good now.

  • RaymanRayman Posts: 15,695

    @Wuerfel_21 Do you have settings for the EC32 module?

  • Should just work

  • RaymanRayman Posts: 15,695

    Ok, it does:

    'Config for Parallax Edge with 32MB PSRAM
    exmem : "exmem_mini" | MEMORY_TYPE = 16

  • RaymanRayman Posts: 15,695

    Having trouble finding any code that works with 96MB module... Sad...

  • RaymanRayman Posts: 15,695

    Ok, @Wuerfel_21 reminded me that the emulators all have suggested PSRAM settings.
    Got 96MB working with MegaYume on P2 Eval board.

    But, these settings don't work with exmem_mini for some reason. Tried a lot of variations, but nothing works...

  • evanhevanh Posts: 16,761

    Might want to try Roger's delay-test reporting programs. They show what "delay" values are suitable. If nothing shows up in the map then that would indicate there is other problems.

    My ram-tester.spin2 is easier to setup and run if you just want to prove the hardware - https://forums.parallax.com/discussion/comment/1569287/#Comment_1569287

  • RaymanRayman Posts: 15,695
    edited 2025-09-27 20:15

    @evanh module works with Megayume but not exmem_mini. Think will just wait and hope that @Wuerfel_21 can figure it out...
    Going to move on to higher resolutions.

    Also thinking about what kind of video your 4-bit uSD driver might be able to deliver...

  • RaymanRayman Posts: 15,695

    This one loads the 8bpp bitmap from uSD instead of hub ram.
    Using the @evanh bashed3 uSD driver with FAT32 (instead of FSRW this time).

    the bmp file has to be on the uSD of course...

  • evanhevanh Posts: 16,761
    edited 2025-09-28 00:30

    @Rayman said:
    Also thinking about what kind of video your 4-bit uSD driver might be able to deliver...

    If you're wanting to push the read speed then disabling the CRC check during reads allows sysclock/2 divider to hit its full capability.
    The example speed tester program has the relevant couple of lines commented out. Uncomment them and you'll see the difference.

    It uses ioctl() and the device handle to set them so the tester make the setting change at mount time, but in reality those settings can be adjusted on the fly as you like.

        clkdiv = 0;
        _ioctl(handle, 70, &clkdiv);    // disable read-block CRC processing
        clkdiv = 2;
        _ioctl(handle, 72, &clkdiv);    // set CLK_DIV value
    

    Of note is the parameter value to be set must be held in hubRAM, hence the "&". That's just the way ioctl() works, since it is allowed to pass a whole structure. The control numbers, 70 and 72, I chose in the driver myself. Here's the full list:

        CTRL_BLOCKREAD_CRC = 70,    // Disables/enables CRC processing of block read, default is enabled
        CTRL_GET_CLKDIV = 71,    // Get the active clock-divider
        CTRL_SET_CLKDIV = 72,    // Set the active clock-divider
        CTRL_GET_CLKPOL = 73,    // (Not implemented)
        CTRL_SET_CLKPOL = 74,    // (Not implemented)
    
  • evanhevanh Posts: 16,761

    Oh, huh, the Spin2 libc support doesn't have ioctl(). I'll ask Eric about it ...

  • RaymanRayman Posts: 15,695

    Think have the 800x480 4.3" IPS LCD board working.
    At least, have something on the screen...

    Seems to be a good fit for this exmem driver.
    Hopefully, will have it going soon...

  • RaymanRayman Posts: 15,695

    Was testing converting the raycaster to use exmem today...

    Starting with the background image (mountains).
    Loading the image from uSD, so doesn't have to be embedded anymore.
    Anyway, at the start of each frame the assembly graphics drivers draw the background image by copying 100 lines of 320 pixels from exmem to HUB screen buffer.

    One interesting thing is how to monitor that exmem is ready for another command.
    Seems it would be better to poll the mailbox base just before writing to the base with new command.
    But, this doesn't work so well, a couple lines flicker.

    Appears better to poll the mailbox base after writing to it.
    Guess this is a hair slower, but produces a stable image...

  • Check out how the Spin exmem_mini code implements this - you check the first long is zero before writing ANYTHING. The longs should either be written last to first or in one go with SETQ+WRLONG (this is generally the fruitful approach for ASM code)

Sign In or Register to comment.