External memory - advice on which way to go?
pacman
Posts: 327
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..
(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
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:
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.
Since the propeller has 32K of hub ram, why not just use that?
Maybe I am missing something?
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).
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...