Shop OBEX P1 Docs P2 Docs Learn Events
Memory drivers for P2 - PSRAM/SRAM/HyperRAM (was HyperRAM driver for P2) - Page 22 — Parallax Forums

Memory drivers for P2 - PSRAM/SRAM/HyperRAM (was HyperRAM driver for P2)

1192022242537

Comments

  • What do you plan for the bottom 4 bits of port B?
  • cgraceycgracey Posts: 14,152
    rogloh wrote: »
    What do you plan for the bottom 4 bits of port B?

    Those just go to the edge-card fingers.
  • Good. They might become useful for trigger input/outputs in a 32 bit logic analyzer application using the remainder of port A, or other control lines etc.
  • evanhevanh Posts: 15,915
    edited 2020-09-24 15:13
    cgracey wrote: »
    Yanomani wrote: »
    IIRC, it was the HyperCK line that was being delayed, not CS#.
    Ah, yes. That makes more sense.
    Yep.

    Write timing parameters at sysclock/2, I believe, due to the nice 90° clock-in-the-middle aspect, can be reliably set the same for all board layouts and any temperature without any care taken.

    Write timing at sysclock/1, without the easy 90° clock phase, is much more impedance sensitive to achieve the right setup and hold timings. However ... if the board layout is done right (Clock and data have matched impedance), I think just by using an unregistered output pin for clock and registered pins for data then that'll give an ideal phase shift between clock and data. No capacitor needed at all. Testing on the Eval Board is tantalising close to this already. https://forums.parallax.com/discussion/comment/1507171/#Comment_1507171 I believe only prevented by the extra load on the data pins from two hyper parts. Assuming this can be done without a capacitor then writes at sysclock/1 should be highly reliable too. Temperature has little to no impact even with the capacitor.

    Read timing parameters is where it gets rough and is layout and temperature sensitive for all decent data rates. The nature of the latencies through the prop2, clock out and data return, plus the external latencies all compound on each other.

    The lookup table, for read timings, that Roger has mentioned will need to be calibrated for each board layout. Probably anything faster than sysclock/8 will need some knowledge or calibration smarts. And in the higher rates the temperature will need to be calibrated for as well. I recommend using a learning algorithm that periodically verifies a block of RAM to find the usable frequency bands and fill the lookup table.

  • roglohrogloh Posts: 5,786
    edited 2020-09-24 15:13
    Looking at a plot of the HyperRAM read timing for sysclk/2 reads, I think I'll need to tweak the breakpoints a bit more in that case. Right now the selected delay is not always the "inner" delay value when multiple choices are possible. This means we might be closer to the data bus edge transitions in time than we want, meaning setup/hold might be more easily violated using those delays.

    See what I mean below when comparing the delay the driver automatically chooses (in parenthesis) vs when the working overlaps occur for the different P2 frequencies in my results below. I think I should keep at least one working delay value (100% transfer success) either side of the selected delay wherever possible. That's not happening with the table yet so I will fix that. Sysclk/1 doesn't have that luxury, there are only ever going to be two working values and just by taking an isolated measurement we don't really know which one has better setup/hold time in advance. We can only measure over a full range and guess where the better delay value will be.
    HyperRAM/HyperFlash memory read delay test over frequency, ESC exits
    Enter the base pin number for your HyperRAM/HyperFlash module (0,16,32) : 32
    Enter a starting frequency to test in MHz (50-350) : [50] 0
    Enter the ending frequency to test in MHz (50-350) : [350] 0
    Enter 1 for fast sysclk/1 read transfers, or 0 for sysclk/2 : [0] 0
    Enter 1 for unregistered clock pins, or 0 for registered pin : [0] 0
    Enter 1 to use the automatic delay value only, or 0 to test over the delay range : [0] 0
    Enter 1 to test HyperFLASH, or 0 for HyperRAM (WARNING test erases last sector of HyperFlash!) : [0] 0
    Testing P2 from 50000000 - 350000000 Hz, driver config flags = $0
    
    				Successful random transfer percentages 
    Frequency      Delay	3	4	5	6	7	8	9	10	11	12
    50000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    51000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    52000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    53000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    54000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    55000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    56000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    57000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    58000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    59000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    60000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    61000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    62000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    63000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    64000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    65000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    66000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    67000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    68000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    69000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    70000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    71000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    72000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    73000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    74000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    75000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    76000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    77000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    78000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    79000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    80000000	 (6) 	0	0	100	100	100	100	0	0	0	0
    81000000	 (6) 	0	0	0	100	100	100	0	0	0	0
    82000000	 (6) 	0	0	0	100	100	100	0	0	0	0
    83000000	 (6) 	0	0	0	100	100	100	0	0	0	0
    84000000	 (6) 	0	0	0	100	100	100	0	0	0	0
    85000000	 (6) 	0	0	0	100	100	100	0	0	0	0
    86000000	 (6) 	0	0	0	100	100	100	0	0	0	0
    87000000	 (6) 	0	0	0	100	100	100	0	0	0	0
    88000000	 (6) 	0	0	0	100	100	100	91	0	0	0
    89000000	 (6) 	0	0	0	100	100	100	100	0	0	0
    90000000	 (6) 	0	0	0	100	100	100	100	0	0	0
    91000000	 (6) 	0	0	0	100	100	100	100	0	0	0
    92000000	 (7) 	0	0	0	100	100	100	100	0	0	0
    93000000	 (7) 	0	0	0	100	100	100	100	0	0	0
    94000000	 (7) 	0	0	0	100	100	100	100	0	0	0
    95000000	 (7) 	0	0	0	100	100	100	100	0	0	0
    96000000	 (7) 	0	0	0	100	100	100	100	0	0	0
    97000000	 (7) 	0	0	0	100	100	100	100	0	0	0
    98000000	 (7) 	0	0	0	99	100	100	100	0	0	0
    99000000	 (7) 	0	0	0	53	100	100	100	0	0	0
    100000000	 (7) 	0	0	0	0	100	100	100	0	0	0
    101000000	 (7) 	0	0	0	0	100	100	100	0	0	0
    102000000	 (7) 	0	0	0	0	100	100	100	0	0	0
    103000000	 (7) 	0	0	0	0	100	100	100	0	0	0
    104000000	 (7) 	0	0	0	0	100	100	100	0	0	0
    105000000	 (7) 	0	0	0	0	100	100	100	0	0	0
    106000000	 (7) 	0	0	0	0	100	100	100	0	0	0
    107000000	 (7) 	0	0	0	0	100	100	100	0	0	0
    108000000	 (7) 	0	0	0	0	100	100	100	0	0	0
    109000000	 (7) 	0	0	0	0	100	100	100	0	0	0
    110000000	 (7) 	0	0	0	0	100	100	100	0	0	0
    111000000	 (7) 	0	0	0	0	100	100	100	12	0	0
    112000000	 (7) 	0	0	0	0	100	100	100	95	0	0
    113000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    114000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    115000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    116000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    117000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    118000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    119000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    120000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    121000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    122000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    123000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    124000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    125000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    126000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    127000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    128000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    129000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    130000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    131000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    132000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    133000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    134000000	 (7) 	0	0	0	0	100	100	100	100	0	0
    135000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    136000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    137000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    138000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    139000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    140000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    141000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    142000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    143000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    144000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    145000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    146000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    147000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    148000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    149000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    150000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    151000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    152000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    153000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    154000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    155000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    156000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    157000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    158000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    159000000	 (8) 	0	0	0	0	100	100	100	100	0	0
    160000000	 (8) 	0	0	0	0	98	100	100	100	0	0
    161000000	 (8) 	0	0	0	0	73	100	100	100	0	0
    162000000	 (8) 	0	0	0	0	0	100	100	100	0	0
    163000000	 (8) 	0	0	0	0	0	100	100	100	0	0
    164000000	 (8) 	0	0	0	0	0	100	100	100	0	0
    165000000	 (8) 	0	0	0	0	0	100	100	100	0	0
    166000000	 (8) 	0	0	0	0	0	100	100	100	0	0
    167000000	 (8) 	0	0	0	0	0	100	100	100	0	0
    168000000	 (8) 	0	0	0	0	0	100	100	100	0	0
    169000000	 (8) 	0	0	0	0	0	100	100	100	0	0
    170000000	 (8) 	0	0	0	0	0	100	100	100	0	0
    171000000	 (8) 	0	0	0	0	0	100	100	100	0	0
    172000000	 (8) 	0	0	0	0	0	100	100	100	0	0
    173000000	 (8) 	0	0	0	0	0	100	100	100	0	0
    174000000	 (8) 	0	0	0	0	0	100	100	100	0	0
    175000000	 (8) 	0	0	0	0	0	100	100	100	0	0
    176000000	 (8) 	0	0	0	0	0	100	100	100	46	0
    177000000	 (8) 	0	0	0	0	0	100	100	100	100	0
    178000000	 (8) 	0	0	0	0	0	100	100	100	100	0
    179000000	 (8) 	0	0	0	0	0	100	100	100	100	0
    180000000	 (8) 	0	0	0	0	0	100	100	100	100	0
    181000000	 (8) 	0	0	0	0	0	100	100	100	100	0
    182000000	 (8) 	0	0	0	0	0	100	100	100	100	0
    183000000	 (8) 	0	0	0	0	0	100	100	100	100	0
    184000000	 (8) 	0	0	0	0	0	100	100	100	100	0
    185000000	 (8) 	0	0	0	0	0	100	100	100	100	0
    186000000	 (8) 	0	0	0	0	0	100	100	100	100	0
    187000000	 (8) 	0	0	0	0	0	100	100	100	100	0
    188000000	 (9) 	0	0	0	0	0	100	100	100	100	0
    189000000	 (9) 	0	0	0	0	0	100	100	100	100	0
    190000000	 (9) 	0	0	0	0	0	100	100	100	100	0
    191000000	 (9) 	0	0	0	0	0	100	100	100	100	0
    192000000	 (9) 	0	0	0	0	0	100	100	100	100	0
    193000000	 (9) 	0	0	0	0	0	100	100	100	100	0
    194000000	 (9) 	0	0	0	0	0	100	100	100	100	0
    195000000	 (9) 	0	0	0	0	0	99	100	100	100	0
    196000000	 (9) 	0	0	0	0	0	95	100	100	100	0
    197000000	 (9) 	0	0	0	0	0	60	100	100	100	0
    198000000	 (9) 	0	0	0	0	0	14	100	100	100	0
    199000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    200000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    201000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    202000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    203000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    204000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    205000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    206000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    207000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    208000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    209000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    210000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    211000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    212000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    213000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    214000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    215000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    216000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    217000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    218000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    219000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    220000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    221000000	 (9) 	0	0	0	0	0	0	100	100	100	0
    222000000	 (9) 	0	0	0	0	0	0	100	100	100	4
    223000000	 (9) 	0	0	0	0	0	0	100	100	100	34
    224000000	 (9) 	0	0	0	0	0	0	100	100	100	79
    225000000	 (9) 	0	0	0	0	0	0	100	100	100	100
    226000000	 (9) 	0	0	0	0	0	0	100	100	100	100
    227000000	 (9) 	0	0	0	0	0	0	100	100	100	100
    228000000	 (9) 	0	0	0	0	0	0	100	100	100	100
    229000000	 (9) 	0	0	0	0	0	0	100	100	100	100
    230000000	 (9) 	0	0	0	0	0	0	100	100	100	100
    231000000	 (9) 	0	0	0	0	0	0	100	100	100	100
    232000000	 (9) 	0	0	0	0	0	0	100	100	100	100
    233000000	 (9) 	0	0	0	0	0	0	100	100	100	100
    234000000	 (10) 	0	0	0	0	0	0	100	100	100	100
    235000000	 (10) 	0	0	0	0	0	0	100	100	100	100
    236000000	 (10) 	0	0	0	0	0	0	100	100	100	100
    237000000	 (10) 	0	0	0	0	0	0	99	100	100	100
    238000000	 (10) 	0	0	0	0	0	0	89	100	100	100
    239000000	 (10) 	0	0	0	0	0	0	57	100	100	100
    240000000	 (10) 	0	0	0	0	0	0	8	100	100	100
    241000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    242000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    243000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    244000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    245000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    246000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    247000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    248000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    249000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    250000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    251000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    252000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    253000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    254000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    255000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    256000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    257000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    258000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    259000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    260000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    261000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    262000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    263000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    264000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    265000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    266000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    267000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    268000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    269000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    270000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    271000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    272000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    273000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    274000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    275000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    276000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    277000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    278000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    279000000	 (10) 	0	0	0	0	0	0	0	100	100	100
    280000000	 (11) 	0	0	0	0	0	0	0	100	100	100
    281000000	 (11) 	0	0	0	0	0	0	0	100	100	100
    282000000	 (11) 	0	0	0	0	0	0	0	100	100	100
    283000000	 (11) 	0	0	0	0	0	0	0	100	100	100
    284000000	 (11) 	0	0	0	0	0	0	0	100	100	100
    285000000	 (11) 	0	0	0	0	0	0	0	100	100	100
    286000000	 (11) 	0	0	0	0	0	0	0	100	100	100
    287000000	 (11) 	0	0	0	0	0	0	0	100	100	100
    288000000	 (11) 	0	0	0	0	0	0	0	100	100	100
    289000000	 (11) 	0	0	0	0	0	0	0	99	100	100
    290000000	 (11) 	0	0	0	0	0	0	0	100	100	100
    291000000	 (11) 	0	0	0	0	0	0	0	97	100	100
    292000000	 (11) 	0	0	0	0	0	0	0	90	100	100
    293000000	 (11) 	0	0	0	0	0	0	0	75	100	100
    294000000	 (11) 	0	0	0	0	0	0	0	33	100	100
    295000000	 (11) 	0	0	0	0	0	0	0	2	100	100
    296000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    297000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    298000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    299000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    300000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    301000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    302000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    303000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    304000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    305000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    306000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    307000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    308000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    309000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    310000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    311000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    312000000	 (11) 	0	0	0	0	0	0	0	0	100	100
    313000000	 (11) 	0	0	0	0	0	0	0	0	99	100
    314000000	 (11) 	0	0	0	0	0	0	0	0	98	100
    315000000	 (11) 	0	0	0	0	0	0	0	0	97	100
    316000000	 (11) 	0	0	0	0	0	0	0	0	96	100
    317000000	 (11) 	0	0	0	0	0	0	0	0	83	100
    318000000	 (11) 	0	0	0	0	0	0	0	0	60	100
    319000000	 (11) 	0	0	0	0	0	0	0	0	35	100
    320000000	 (11) 	0	0	0	0	0	0	0	0	5	100
    321000000	 (11) 	0	0	0	0	0	0	0	0	1	100
    322000000	 (11) 	0	0	0	0	0	0	0	0	0	100
    323000000	 (11) 	0	0	0	0	0	0	0	0	0	100
    324000000	 (11) 	0	0	0	0	0	0	0	0	0	100
    325000000	 (11) 	0	0	0	0	0	0	0	0	0	100
    326000000	 (11) 	0	0	0	0	0	0	0	0	0	100
    327000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    328000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    329000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    330000000	 (11) 	0	0	0	0	0	0	0	0	0	100
    331000000	 (11) 	0	0	0	0	0	0	0	0	0	100
    332000000	 (11) 	0	0	0	0	0	0	0	0	0	100
    333000000	 (11) 	0	0	0	0	0	0	0	0	0	100
    334000000	 (11) 	0	0	0	0	0	0	0	0	0	100
    335000000	 (11) 	0	0	0	0	0	0	0	0	0	100
    336000000	 (11) 	0	0	0	0	0	0	0	0	0	86
    337000000	 (11) 	0	0	0	0	0	0	0	0	0	40
    338000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    339000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    340000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    341000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    342000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    343000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    344000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    345000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    346000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    347000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    348000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    349000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    350000000	 (11) 	0	0	0	0	0	0	0	0	0	0
    Enter the base pin number for your HyperRAM/HyperFlash module (0,16,32) : 
    Exiting
    
  • cgraceycgracey Posts: 14,152
    edited 2020-09-24 15:47
    Thanks, Evanh and Rogloh.

    We'll make the layout so we can run them as a pair or separately, and we'll have the flexibility to do sysclk/1 or sysclk/2. It's going to be a very tight layout. I think the longest route will only be about 13mm.

    Yes, it seems some periodic recalibration should be done to track temperature.

    In the future, it would be really nice to build 8-tap digital delay lines into the I/O pins so that incoming and outgoing data could be registered at any 45-degree offset in the clock cycle. That would provide ultimate flexibility for full-speed data transactions. Wouldn't it be cool if there was a 3-bit selector for an I/O pin's phase? You'd still have multi-clock delays for fast signals, but you could have 8 divisions of the clock to pick from within the cycle of interest.
  • Cluso99Cluso99 Posts: 18,069
    Would be much better to have SPI support with auto clock generation or reception sort of like the UART. A general purpose extension to the UART so it could also do I2C. Not sure if I2S is also in the same ilk too.
    Of course, hindsight is wonderful. I guess it will be years before we see another P2 revision due to cost :(

    Still think a few really simple and really fast bit-bang cpus would be better instead of smart pins. Think of a full-speed (400+MHz single clock ie 4-port 128x32 cog ram) with only basic bit/byte/word/long manipulation instructions ie less than P1. If these were close to the I/O pins ie no clock delays to input/output a lot of current problems would disappear.

    Anyway, 90nm looks to be more on the horizon now and that may bring 1GHz :)
  • evanhevanh Posts: 15,915
    edited 2020-09-24 23:40
    Funnily, sync serial output is generally the trickier one to handle in the smartpins because those modes use external clock (As an enable rather than a true clock), whereas the streamer is blind to any clock, it just metronomically paces off the sysclock. This means that all the prop2 latencies then pile onto the sending smartpin. Only the external latencies stay with the reading smartpin.

    In the end the streamer's clock blindness seems to play to its advantage ... when used as a master device at least.

  • Honestly, just having a "half clock" registered delay would have been helpful.

    Which in practice would be either the registered one-clock ff delay rising edge that exists now, and in addition a one-and-a-half clock ff delay on the falling edge.
  • evanhevanh Posts: 15,915
    edited 2020-09-25 00:20
    There's no end to the possible niceties. Certainly, I could see providing the falling edge of sysclock for I/O as a handy timing trick.
    cgracey wrote: »
    In the future, it would be really nice to build 8-tap digital delay lines into the I/O pins so that incoming and outgoing data could be registered at any 45-degree offset in the clock cycle.
    Wouldn't that need an 8x PLL running?

  • YanomaniYanomani Posts: 1,524
    edited 2020-09-25 01:19
    evanh wrote: »
    Wouldn't that need an 8x PLL running?

    8x PLL or 8-stage PLL VCO (ooops! my bad)? :smile:
  • roglohrogloh Posts: 5,786
    edited 2020-09-25 02:51
    evanh wrote: »

    Write timing at sysclock/1, without the easy 90° clock phase, is much more impedance sensitive to achieve the right setup and hold timings. However ... if the board layout is done right (Clock and data have matched impedance), I think just by using an unregistered output pin for clock and registered pins for data then that'll give an ideal phase shift between clock and data. No capacitor needed at all. Testing on the Eval Board is tantalising close to this already.

    @evanh At the moment, my registered/unregistered clock option is something applied only at startup time to patch both the read and write code timing to account for it and to configure the clock pin appropriately for it (once) using WRPIN. This currently means that enabling unregistered clocks to improve sysclk/1 writes also enables it for the reads as well, and we know that setting reduces the read performance. To resolve that and make the choice of reg/unreg clocks independent for reads and writes requires setting up this clock pin state on each transaction. It would be at least 3 more instructions needed as I have 3 read/write code paths, or maybe two if I limit it just to the RAM writes and restore the clock pin state at the end. If we lock down the unregistered clock write settings at some point to exclude flash and register writes and not be applied to reads, I could free this waitx in the read path, and the waitx in the flash/register write paths and that gives me two instructions.

    Otherwise for gaining more instructions I would need to make room by losing my fast vector jump table per bank, which in itself will add 2 more instructions to the path. :frowning:

    Right now all I need to do in the read/write code paths to accommodate an unregistered clock is to have a WAITX clkdelay and I setup this clkdelay value to be either 1 or 0 at startup time, depending on choice of the reg/unreg clock. I'd still need to keep that, but I also would need the extra WRPIN instructions too.

    Existing:
                                setxfrq xfreq2                  'setup streamer frequency (sysclk/2)
                                waitx   clkdelay                'odd delay shifts clock phase from data
                                xinit   ximm4, addrhi           'send 4 bytes of addrhi data
                                wypin   clks, clkpin            'start memory clock output 
    

    If I could only save something in the 3 instructions I already have to burn to reset the Smartpin clock phase for transition mode on the clock pin, and/or combine it with WXPIN operation here if could help give me more room... This gets done in 3 places too.
                                drvl    cspin                   'drop CS pin to start the next transfer
                                fltl    clkpin                  'disable Smartpin clock output mode
                                wxpin   #2, clkpin              '...to resync for 2 clocks between transitions
                                drvl    clkpin                  '...and re-enable Smartpin   
    
  • evanhevanh Posts: 15,915
    whicker wrote: »
    Which in practice would be either the registered one-clock ff delay rising edge that exists now, and in addition a one-and-a-half clock ff delay on the falling edge.
    Ah, of course, use both stages to form a simple short route for the needed fast propagation.

  • evanhevanh Posts: 15,915
    rogloh wrote: »
                                drvl    cspin                   'drop CS pin to start the next transfer
                                fltl    clkpin                  'disable Smartpin clock output mode
                                wxpin   #2, clkpin              '...to resync for 2 clocks between transitions
                                drvl    clkpin                  '...and re-enable Smartpin   
    

    No need to lower and raise DIR for low-level pin mode changes. The low-level P settings of WRPIN is separate from smartpin M mode changes. They could have been two instructions really.

  • Yeah, I know about pin mode. But it seems to be needed to clear the transition mode phase.
  • evanhevanh Posts: 15,915
    edited 2020-09-25 02:56
    Oh, that. That's a different problem, to do with internal timers of the smartpin mode. They don't stop ticking at end of pulse stream.

    I'm out of time now. Need to get to work. My first week of rotating shifts. Will be back on day shift next week.

  • I tidied up the automatic latency configuration after driver restart which should suit boards like the future P2 Edge and P2D2 as they don't wire a dedicated P2 pin to control the HyperRAM reset. In theory this code should also now work with V2 HyperRAM assuming the V2 HyperRAM detection works according to section 6.1 information in this V1->V2 HyperRAM migration application note from Cypress below.

    https://www.cypress.com/file/498626/download

    In fact I don't think we will need to do a lot more than this to get the V2 HyperRAM to work. I've made it such that the HyperRAM latency is set the same, unless the Hyper bus clock frequency is greater than 100MHz and we are using the newer V2 RAM which can be operated faster, but requires the larger latency in order to not overclock. Once we get V2 HyperRAM we can try to run a P2 up to 400MHz and see if the memory still works! LOL.

        'Loop through bus devices and setup a default device latency in case it had been changed 
        'prior to this driver restarting, and if its reset pin was not enabled.  An obscure case.
    
        repeat i from 0 to NUMBANKS-1
            device := devices[bus * 2 * NUMBANKS + i]
            if device
                if device & F_FLASHFLAG
                    repeat j from 0 to 15 ' find any address mapped to this bus
                        if addrMap[j]==bus
                            setFlashLatency((j<<28)+(i<<24), DEFAULT_HYPERFLASH_LATENCY)
                            quit
                            
                else 
                    repeat j from 0 to 15 ' find any address mapped to this bus
                        if addrMap[j] == bus
                            ' assume Version 1 HyperRAM for now
                            latency := DEFAULT_HYPERRAM1_LATENCY
                            ' check for Version 2 HyperRAM 
                            id := readRamIR((j<<28)+(i<<24), 1, 0) ' read IR1
                            if id & $ff == 1 ' if V2 HyperRAM, check operating frequency
                                if ((flags & (F_FASTREAD|F_FASTWRITE)) && freq > 200000000)
                                    latency := DEFAULT_HYPERRAM2_LATENCY
                            setRamLatency((j<<28)+(i<<24), latency)
                            quit
    
    
  • Yes it annoying there is still no stock of v2 hyperram unless you take a full tray
  • Is v2 cheaper or more expensive than v1?
  • roglohrogloh Posts: 5,786
    edited 2020-09-25 06:04
    Had my DDR bus speed confused above, here's the actual mapping of V2 HyperRAM latency values with bus frequency (Cypress). Seems we can possibly tighten it up further, although I need some of the latency period to execute P2 code.
    0000 - 5 Clock Latency @ 133 MHz Max Frequency
    0001 - 6 Clock Latency @ 166 MHz Max Frequency
    0010 - 7 Clock Latency @ 200 MHz/166 MHz Max Frequency (default) 
    0011 - Reserved
    0100 - Reserved
    ...
    1101 - Reserved
    1110 - 3 Clock Latency @ 85 MHz Max Frequency
    1111 - 4 Clock Latency @ 104 MHz Max Frequency
    
  • evanhevanh Posts: 15,915
    edited 2020-09-25 13:36
    rogloh wrote: »
    If I could only save something in the 3 instructions I already have to burn to reset the Smartpin clock phase for transition mode on the clock pin, and/or combine it with WXPIN operation here if could help give me more room... This gets done in 3 places too.
                                drvl    cspin                   'drop CS pin to start the next transfer
                                fltl    clkpin                  'disable Smartpin clock output mode
                                wxpin   #2, clkpin              '...to resync for 2 clocks between transitions
                                drvl    clkpin                  '...and re-enable Smartpin   
    

    You should be able to use WXPIN #1,clkpin by itself, as a timer reset, straight after completion of the clock pulses. eg:
                                drvh    cspin                   'raise CS pin to complete transfer
                                wxpin   #1, clkpin              'cancel the period timer of transition mode
    

    Then, for the next burst of clocks, set the desired period at the same place as the critical DIRH clkpin was. DIR can be left high all the time then. The clock smartpin can be enabled (DIRH) at init time and left that way.

    PS: Bear in mind this trick works with transition mode. It's not a cure all for other smartpin modes that may suffer similar niggles.

  • roglohrogloh Posts: 5,786
    edited 2020-09-25 13:40
    Thanks evanh I'll have to give that a try sometime to see if it works out - I know I've had issues with this stuff in the past, and once I found something that worked, I sort of took it and stopped searching for better ways to do it.
  • evanhevanh Posts: 15,915
    edited 2020-09-25 14:06
    Actually, it's important that there is some sysclocks between the WXPIN #1 and any subsequent desired period setting. The exact requirement depends on what the prior period setting was. If the period was 500 then you'd want 500 sysclocks to ensure the cancellation takes effect. Otherwise the trick won't help. In other words, I'm counting on small periods always being applied.

    PS: Of course, it's not really cancelling anything. I called it that just because a period of one eliminates the timing niggle that occurs when the period is more than one.

    Look at it like the non-blocking FIFO setting. Where the data will be fetched while further instructions are executing, and as long as you have enough other things to do before needing the data then the FIFO will be ready in time. Issuing the WXPIN #1 early enough means the smartpin will be in a desirable state in time for the next burst of clocks to be exactly timed.
  • Yeah ok, well I use only wxpin #2, clkpin and wxpin #1, clkpin, so these are just very small periods to setup.
  • evanhevanh Posts: 15,915
    :) Good. Just thought I'd clear up a detail as to possible source of prior problems in testing this sort of trick.

  • cgraceycgracey Posts: 14,152
    edited 2020-09-25 20:00
    evanh wrote: »
    There's no end to the possible niceties. Certainly, I could see providing the falling edge of sysclock for I/O as a handy timing trick.
    cgracey wrote: »
    In the future, it would be really nice to build 8-tap digital delay lines into the I/O pins so that incoming and outgoing data could be registered at any 45-degree offset in the clock cycle.
    Wouldn't that need an 8x PLL running?

    I think there are simpler circuit topologies used for doing that kind of thing, but a PLL would work.

    I found this about DLL's:

    https://rtldigitaldesign.blogspot.com/2016/06/difference-between-pll-and-dll.html#:~:text=In electronics, a delay-locked,replaced by a delay line.&amp;text=The output of the DLL,resulting, negatively delayed clock signal.

    It's like a PLL, but you get to adjust the integrator on EVERY source clock. The integrator controls delay elements. If you had eight of them, you could make 8 phases of the input clock. If we had ten delay elements, we could do HDMI very nicely.
  • evanhevanh Posts: 15,915
    edited 2020-09-25 23:48
    Good link Chip.
    DLLs are commonly used in high-speed communications among chips on a board (e.g., between a memory controller and its SDRAM chips) in order to "cancel out" things like input and output buffer delays as well as wiring delays, allowing very tight control over setup and hold times relative to the clock signal. This allows data rates to be much higher than would otherwise be possible.
    That sure rings a bell. :)

    The delay line ring is drawn as a chain of buffers. How fast is a cold buffer in the used On Semi process? 100 ps maybe. The delay chain wouldn't have to cover lower frequencies I presume. Those can be dealt with using a high sysclock if desired. I'm guessing 20 ns maybe 40 ns max delay in the chain. It'll be temperature dependant so will need a worst case number of elements. We're wanting sub-nanosecond resolution anyway, so 400 elements and taps needed?

  • evanh wrote: »
    rogloh wrote: »
    If I could only save something in the 3 instructions I already have to burn to reset the Smartpin clock phase for transition mode on the clock pin, and/or combine it with WXPIN operation here if could help give me more room... This gets done in 3 places too.
                                drvl    cspin                   'drop CS pin to start the next transfer
                                fltl    clkpin                  'disable Smartpin clock output mode
                                wxpin   #2, clkpin              '...to resync for 2 clocks between transitions
                                drvl    clkpin                  '...and re-enable Smartpin   
    

    You should be able to use WXPIN #1,clkpin by itself, as a timer reset, straight after completion of the clock pulses. eg:
                                drvh    cspin                   'raise CS pin to complete transfer
                                wxpin   #1, clkpin              'cancel the period timer of transition mode
    

    Then, for the next burst of clocks, set the desired period at the same place as the critical DIRH clkpin was. DIR can be left high all the time then. The clock smartpin can be enabled (DIRH) at init time and left that way.

    PS: Bear in mind this trick works with transition mode. It's not a cure all for other smartpin modes that may suffer similar niggles.

    Gave this idea a quick go, but seeing problems with first read byte/word which seems to be zeroed. Something is not right with the clocks, and I'm not willing to dig into it right now. I'm putting this idea on hold until after the initial release. If it can be figured out reliably/consistently it might be something that can save some instructions. It's tricky because introducing instructions like rdlut which are 3 clocks can then throw it off and there need to be an exact number of clocks to align the data if in the different cases of registered/unregistered clock and data buses, plus sysclk/1 and sysclk/2. Lots of cases to all get right.
  • evanhevanh Posts: 15,915
    Your code is tuned to handle WXPIN #2. I suspect there will be an inbuilt reliance on it.
  • Most probably yes. I always do the address phase setup with sysclk/2.
Sign In or Register to comment.