Shop OBEX P1 Docs P2 Docs Learn Events
8-bit PSRAM Chip driver development - Page 2 — Parallax Forums

8-bit PSRAM Chip driver development

2»

Comments

  • RaymanRayman Posts: 13,894

    This simple spin2 code now can read/write memory

  • RaymanRayman Posts: 13,894

    @evanh Sorry, still all 0%

  • evanhevanh Posts: 15,188

    @Rayman said:
    This simple spin2 code now can read/write memory

    Huh, your read latency is only 1 x LC, the datasheet says 2 x I thought ... try this then:

  • evanhevanh Posts: 15,188
    edited 2022-09-24 23:22

    Oh, I'd missed the default "variable" config, MR0[5]=0. Opposite to HyperRAM default. That means I either need to test the DQS signal on each read or program the config bits for fixed latency.

    EDIT: Err, hmm, looks like DQS works quite differently than with hyperRAMs. It seems to rely on a delayed first-byte strobe to signal "pushout" of latency. There's no way to handle that at burst speeds other than to use a post-read temporary buffer to later analyse to extract the data from. Which is hardly an efficient solution.

  • RaymanRayman Posts: 13,894

    @evanh That works!
    Got a lot more 100%s when I increased drive strength to full

  • evanhevanh Posts: 15,188

    @Rayman said:
    @evanh That works!
    Got a lot more 100%s when I increased drive strength to full

    Nice. I guess I should add the register read/write routines now. So the drive strength can be set ... and set fixed read latency too.

  • RaymanRayman Posts: 13,894
    edited 2022-09-24 23:36

    How do these results compare with hyperram?

    I think fixed latency is not needed for linear burst mode, right?

  • evanhevanh Posts: 15,188

    @Rayman said:
    How do these results compare with hyperram?

    Looks same. The real test is at sysclock/1 but both existing designs are known flawed for that test so no point trying until a better board layout is done.

    I think fixed latency is not needed for linear burst mode, right?

    Fixed is needed. Otherwise a DRAM refresh can glitch the assumed timing.

  • evanhevanh Posts: 15,188
    edited 2022-09-25 00:15

    Here's another update with MR0 blindly set to $28 - Fixed latency + 50 Ohm drive strength. And I've changed the base pin to 0 now too. :)

  • evanhevanh Posts: 15,188
    edited 2022-09-25 00:46

    @evanh said:
    Fixed is needed. Otherwise a DRAM refresh can glitch the assumed timing.

    HyperRAM is superior here. It pre-warns of an additional LC with a long RWDS signal for the duration of CA phase. So it's much easier to check for and adjust the number of extra clocks needed on the fly. (EDIT: Not that I ever did this. Fixed latency is the default for HyperRAM and it's much easier to just leave it that way.)

  • Can we convert this Hyper RAM Spin2 code be converted to SPIN ?

  • @jlsilicon said:
    Can we convert this Hyper RAM Spin2 code be converted to SPIN ?

    Because the code uses the smartpins and streamer (P2 only hardware features) it cannot run on P1, if that's what you're thinking of.

  • jlsiliconjlsilicon Posts: 92
    edited 2023-11-15 15:25

    I am just asking for SPIN code to use Hyper SPI RAM Aps6404 / Aps12808 etc on Propeller1.
    -- The Hyper SPI RAM Aps6404 / Aps12808 communication is close to same as 24c32 chips etc.

    I see 24c32 Spin code - but it only uses 2 byte addressing.
    Aps6404 - uses 3 byte addressing.

  • evanhevanh Posts: 15,188
    edited 2023-11-16 21:30

    AT24C32 is I2C interface. That's quite different to any of the SPIs. Hyperbus is not a regular SPI either. That said, there must already be SPI objects for the Prop1 surely. The Obex is offline right now though - https://obex.parallax.com/obex/

  • jlsiliconjlsilicon Posts: 92
    edited 2023-11-17 00:30

    i found some SPI code examples..

    Just need to figure out how to convert it to Ips6404 chips (with 3 byte adressing).

    Single_23LC1024.spin
    -- need to remove the confusing Cache code though ...
    -- read/write string Functions :
    PUB RamRead/WriteString(plSrcRamAddr, plDstAddr, pwQtyBytes, plRtnBusyFlagAddr) | tmpTest, tmpFlag, tmpCount
    -- -- is a misnomer , this is a memcpy() , strcpy() checks for CR/NL , these routines do Not.

    23lc1024.spin
    -- don't feel like learning PASM - so skip this

    https://forums.parallax.com/discussion/174269/has-anyone-written-a-driver-for-microchip-23lc1024-sram-chip

  • evanhevanh Posts: 15,188
    edited 2023-11-17 00:45

    Ada is very skilled. If she wrote it then it'll be fast. Are you wanting to handle much runtime data, or is this just for config store?
    Andre was also highly skilled. Before my time though. Don't know where the referenced SRAM_driver_23K256_v010.spin object is.

  • jlsiliconjlsilicon Posts: 92
    edited 2023-11-17 01:09

    I do Robotocs & Programming & Electronics - as both Hobby and as a Career.
    I intend to use this RAM for AI & Robotics & Visual Recognition.

    I already use this PSRAM Ips6404 on both Arduino and ARM chips.

    -- Thought that I would play with the Propeller/2 - and see what it is really capable of ...
    :smiley:

    ps: Your SRAM_driver_23K256_c010.spin :
    https://parallax.com/package/an012-interfacing-the-propeller-to-external-sram-with-spi/
    -- looks easier , still need to expand the address bytes from 16 to 24bits ... maybe just a quick patching job ...

  • jlsiliconjlsilicon Posts: 92
    edited 2023-11-17 01:17

    From Single_23LC1024.spin - may already work :

    PRI RamSendCommandPlusAddress(pbCommand, plAddress)
    '
    '-> Note: RamChipSelect must be called before calling this method.
    '
    '-> Send SPI Command and address
    If (_baRamBusMode == RAM_BUSMODE_SPI)
    'send command
    RamSpiTransfer(pbCommand )
    'send address
    RamSpiTransfer(((plAddress & $FFFFFF) >> 16))
    RamSpiTransfer(((plAddress & $FFFF) >> 8))
    RamSpiTransfer(plAddress & $FF)
    '
    '-> Send SDI Command and address
    ElseIf (_baRamBusMode == RAM_BUSMODE_SDI)
    'send command
    RamSdiTransfer(pbCommand )
    'send address
    RamSdiTransfer(((plAddress & $FFFFFF) >> 16))
    RamSdiTransfer(((plAddress & $FFFF) >> 8))
    RamSdiTransfer(plAddress & $FF)
    '
    '-> Send SQI Command and address
    ElseIf (_baRamBusMode == RAM_BUSMODE_SQI)
    'send command
    RamSqiTransfer(pbCommand )
    'send address
    RamSqiTransfer(((plAddress & $FFFFFF) >> 16))
    RamSqiTransfer(((plAddress & $FFFF) >> 8))
    RamSqiTransfer(plAddress & $FF)
    'EndIf
    '
    'END_PRI

  • evanhevanh Posts: 15,188

    @jlsilicon said:
    I already use this PSRAM Ips6404 on both Arduino and ARM chips.

    For image data?

    Prop2 can definitely go much faster than the Prop1. Not to mention it has more pins. Streamer hardware is good as a master.

  • jlsiliconjlsilicon Posts: 92
    edited 2023-11-17 01:30

    23LC1024 Cmds :

    '-> [Commands] 23LC1024 Commands
    '------------------------------------------------------------------------------------------------------------------------------
    RAM_CMD_NONE = 0
    RAM_CMD_WRMR = %00_000001 '$01 - Write mode register
    RAM_CMD_WRITE = %00_000010 '$02 - Write data to memory array beginning at specified address
    RAM_CMD_READ = %00_000011 '$03 - Read data from memory array beginning at specified address
    RAM_CMD_RDMR = %00_000101 '$05 - Read mode register
    RAM_CMD_EQIO = %00_111000 '$38 - Enter quad io bus mode
    RAM_CMD_EDIO = %00_111011 '$3B - Enter dual io bus mode
    RAM_CMD_RSTIO = %11_111111 '$FF - Revert to spi io mode

    -

    Ips6404 Cmds :

    Read = 0x03
    Fast Read = 0x0B
    Fast Read Quad = 0x3B
    Write = 0x02
    Quad Write = 0x38
    Enter Quad Mode = 0x35
    Exit Quad Mode = 0xF5
    Reset 0x99

    -

    -- Pretty Close - no Conflict , just Exit Differs : 0xFF / 0xF5

  • evanhevanh Posts: 15,188

    There sure is a lot of mode variations. In one device I remember it supporting six distinct transfer modes: Slow, Fast, Dual, Quad, DPI, and QPI.

  • jlsiliconjlsilicon Posts: 92
    edited 2023-11-17 03:02

    But, I only see SPI and Fast SPI and SQuad and FastReadQuad on the Aps6404

  • evanhevanh Posts: 15,188
    edited 2023-11-17 05:45

    Yup. Sorry, I was talking about another PSRAM again. When I tweaked a bit-bashed booter to use smartpins I used a fancy mode that was in the EEPROM on the Prop2 Eval Board. I never really looked nor considered if it was a common mode or not at the time. My mistake because after a while people wanted to use the Prop2 with other EEPROMs and started finding problems with the code.

Sign In or Register to comment.