I’m working on a project that will involve the user scrolling through a list of options (DVD titles in this case) to select the desired title. Eventually I’ll have a way for the user to edit these titles, move them around in memory, etc.
The code to do all this is not what’s worrying me. What I need is a way to store it after power is cycled. The list needs to be read from memory, edited, and then stored to flash memory.
Now, the LPC2106 development board doesn’t have an SD card slot on it, and while I see a couple options for cards (both SD and microSD) on Sparkfun, I’m not really sure where to start. I see tutorials even, but few of them are written in C, much less for the ARM7 platform.
Do any of you have recommendations for which type of card would be easiest to start with? (Or are they both the same level of complexity?)
What about the code to read from the card itself? Any good tutorials for the ARM platform?
Or can I do this on the LPC2106 itself, without even using the card? I’ll have a list of perhaps 30 titles. Each entry in the list would consist of a DVD title (maybe 20 characters), a slot number, and maybe one or two other things yet to be determined. I think that chip has some flash memory already on-chip, doesn’t it? I just need a way to store some plain text so it’s not lost when power is cycled.
eewestcoaster:
Do any of you have recommendations for which type of card would be easiest to start with? (Or are they both the same level of complexity?)
SD and Micro-SD are exactly the same thing. The only difference is the physical size of the card.
What about the code to read from the card itself? Any good tutorials for the ARM platform?
The interface for SD cards is ultra simple SPI. Initializing, reading and writing code is not terribly difficult to write. Of course it seems tough the first time you do it, but really it's not so hard.
For a nice clear demo of how to do it, have a look at Lucio Di Jasio’s book, “Programming 16-bit Microcontrollers in C: Learning to Fly the PIC24”. Yes, it’s for PIC24’s, but that doesn’t matter much - C and SPI and how to read/write SD cards works pretty much the same way for any MCU. Only the actual SPI read/write and init functions will be different, because of the different hardware. Very simple stuff. There’s a chapter in there on interfacing and coding for SD cards. And there’s a chapter on FAT16, which is helpful if you’ve forgotten all that stuff like I had.
If you need to be able to read the card in a PC then you have to do a FAT16 or FAT32 file-system to read/write the card. That’s a bit more work. But if it’s just for the MCU then it’s probably easier to just read/write the card raw.
Or can I do this on the LPC2106 itself, without even using the card? I’ll have a list of perhaps 30 titles. Each entry in the list would consist of a DVD title (maybe 20 characters), a slot number, and maybe one or two other things yet to be determined. I think that chip has some flash memory already on-chip, doesn’t it? I just need a way to store some plain text so it’s not lost when power is cycled.
LPC2106 has 128K of Flash. As long as your program isn't using it all you should have no problem writing some code to store a couple of K of data in Flash.
I know the various memory card types are identical in terms of end use (cameras, etc), but I’ve never written to anything but a 40-pin EEPROM chip a few years ago in one of my University courses. I was hoping they’d only vary in size, but I gave up on such optimism a long time ago.
I’ve heard a lot about SPI, I guess it’s time to dig in and learn it. Doesn’t seem too complicated from what I’ve seen, so that’s encouraging. I’ll definitely grab a copy of that book, too.
I’ve got big plans for this project, but I’m trying to be realistic. For example, it would be great to develop a GUI for it so I can modify the database and then just move the card back to the device for operation. But I think for now it’ll be better to just keep it simple.