Shop OBEX P1 Docs P2 Docs Learn Events
External memory - advice on which way to go? — Parallax Forums

External memory - advice on which way to go?

pacmanpacman Posts: 327
edited 2010-12-27 15:02 in Propeller 1
As part of my dupline interface project I need to store (a maximum) of 256 strings of
(in case I move to a 2 x 20 display) 41 characters.

So by my calcs that comes in at a little over 10K of memory. So I need to move to some forms of external memory.

Ideally this external memory would be organized so as any lookups into it would be pretty quick and involve 'easy' maths {I need to grab message 84, go read 41 chars back from location [84 x constant]}

The messages start on a SD card, but might not be in numerical order, and not all messages are necessarily used (so we might have a message 84 and a message 86, but no message 85), hence I'm thinking I'll read the SD card on power-up and organise the messages in the external memory.

But that's where I get a bit lost - should I use SRAM or some other form of memory? (perhaps reorganising the SD card messages would be better?) Perhaps I'm going about it all wrong and there is the simple obvious solution I've missed?

Your comments and insights would be appreciated..

Comments

  • Cluso99Cluso99 Posts: 18,069
    edited 2010-12-25 14:05
    pacman: You could use the upper 32KB of the eeprom (presuming you have a 64KB version - many pcbs have 64KB). This would be the easiest without an SD card.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2010-12-26 03:06
    The main advantage of external ram is writing and reading. Especially writing, as that does not wear out external ram in the same way writing to an sd card or eeprom.

    If you are only reading data, I've first start by putting the data in eeprom like Cluso suggests, then look at storing the data in the sd card.

    If all that fails, external ram is not that hard to use. There is cog code around that makes it a lot easier.

    Or you can do this in C running in external memory. Then you have 512k to play with. I'm writing C code this evening on a propeller with external memory, and the whole driver and keyboard and mouse and display and sd card are part of the system, so you can just get on with writing the code:
    /* Traditional first C program */
    
    #include <stdio.h>
    
    void main ()
    {
           printf("Hello, World!\n");
           while (1);                                                   
    }
    

    With over 500k of code space still free. See my link at the bottom for the board this runs on.

    But I think this ought to be possible with lots of text files on an sd card, and maybe a nice simple sd card driver like Kye's fat32 code, and do it in Spin.
  • hinvhinv Posts: 1,255
    edited 2010-12-26 07:36
    Your original explanation of the task begs th question:

    Since the propeller has 32K of hub ram, why not just use that?

    Maybe I am missing something?
  • MagIO2MagIO2 Posts: 2,243
    edited 2010-12-26 09:45
    If you already have an SD-card, why do you want to copy it into RAM that you'd have add to your system first?
    RAM only makes sense in case you need faster access or you have to write the messages very often.
    EEPROM would be fine if you want to make sure the strings are also availabe if SD card fails.

    If you want easy access to the messages, then watch out for the "virtual memory" additions I've done for the FSRW SD card driver. (I'll search for the thread)
    These additions allow to have a big file on SD card and access any memory location inside of this file. The original FSRW functions are still available, so you can open/read/write another file at the same time.

    In my COG OS I also put all the strings I have including messages and help-screens into "virtual memory" and read em when needed. This works pretty good.

    Find the vMem in this thread: http://forums.parallax.com/showthread.php?117573-Virtual-Memory
    Read the first post for preconditions and take the sources from my last post (currently;o).
  • pacmanpacman Posts: 327
    edited 2010-12-27 15:02
    hinv wrote: »
    Your original explanation of the task begs th question:

    Since the propeller has 32K of hub ram, why not just use that?

    Maybe I am missing something?

    Methinks your correct - I need to re-read the manual but I _think _i may getting confused with cog ram and hub ram.

    I'll update after I have re-read...
Sign In or Register to comment.