This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Write to SD card from Stellaris Launchpad LM4F120



Hi,

The launchpad doesn't have a SD card reader attached to it, as i'm sure many of you are aware.  However, I do still want functionality of writing to an SD card.  I am mainly wondering what I need to initialize the pins as for them to write and read from an SD card.  The DAT0 - DAT3 pins are the ones I'm mainly concerned with.  I don't know if they are supposed to be configured as UART's or if they are to be left as GPIO pins and then just write from there.  I have never had to manually set up an SD card before so I don't exactly know how it works, and I haven't been able to get a clear answer from looking online beyond just what each connector on the SD card is for. 

Any help on what to initialize the pins to would be helpful.

Thanks,

  • I don't think the LM4F120H5QR has an SD peripheral?

    Therefore, you'll just have to use the SPI  mode - as implemented on several of the TI Stellaris Cortex-M3 boards, and some TI MSP430 boards, and many other boards from other manufacturers...

  • For the price of the launchpad - not too many are surprised that some things are missing.  The "big brother" of the launchpad - the ek-lm4f232 board - includes an SD card socket.  The file, "sd_card.c" - w/in the ek-lm4f232 file directory - will be of great value.

    Indeed - as the earlier poster stated - you must use SSI to "talk" to an SD card.  You can find such functionality on your lesser MCU.

    Your challenge further is to acquire an SD card socket - mount it - and wire it into the launchpad.  If funds allow - may be easier (surely faster) to purchase the ek-lm4f232 kit...

    If you seek to "read" this card via a PC - and to exchange data between your MCU and the PC (via such card) you must adapt some file system.  (normally the FAT file system) 

    This is a big project for an early user of the launchpad - suggest that you perform many of the exercises and read/re-read the MCU datasheet and the many related posts this forum and elsewhere - before attempting...

  • Hi,

    Yes the launchpad doesn't have the sd peripheral, we have ordered an SD card reader to mount on an external PCB that we have, and we are trying to figure out how to wire it, which is why I was wondering about the pins that we should be using and how they should be initialized.

    I wish we had the funds for the "big brother" boards, but we don't have much money, so I am going to have to work with what we got.  

    Thanks

  • Samuel Hosig said:
    wondering about the pins that we should be using and how they should be initialized.

    This is explained - and modeled - w/in the file I previously mentioned for you.  (sd_card.c)  It may be that the pinouts on the LX232 differ from those of your launchpad - you'll have to check.  Should they match - the referenced file should do the great bulk of the, "set-up and pin configuration" for you - but possibly not all.  Should pinouts not match - your task is to find a suitable SSI port (4 pins) which route to the launchpad's edge connector. 

    You'll also have to power the sd_card - consider the total power requirement of both the launchpad and your sd_card - if too high you'll have to power the sd_card from a separate source - and then insure that both (launch & sd card) power up/down in some sync.

    Again - this is a demanding project - appears that you've not exhaustively read/studied the MCU datasheet - strongly suggest that you perform the many launchpad experiments - and build your knowledge/confidence - before doing battle w/ an sd card...

    You never state "why" the sd_card is so crucial - there is reasonable amount of memory w/in your MCU - maybe you can store much/most of your data w/in MCU flash - and avoid the challenge of the sd_card - for so early a project...

  • I'm just getting started with the process of the SD card and it will be a while before we are actually getting this completely implemented.  I need the SD card because we need to keep track of measurements that are going to be calculated so they can be analyzed later by an outside source.  I'm sorry if it sounds a little cryptic but, I don't know what is confidential information and what isn't.  

    I know I haven't studied the datasheets a whole lot, and this is a new product so there is a lot of work to be done.  This is right now just an extra that we are trying to put together and its looking like it's going to be more work than we initially thought.  There is a utility on the TI Stellaris launchpad site that helps configure pins for the board.  Now I am going to need to do my work to study the data sheets and the SSI protocol further to make sure I know what everything means.

  • Samuel Hosig said:
    I know I haven't studied the datasheets a whole lot

    Well, that is  fundamental to any development!

    Note that, as already mentioned, SD Cards are very widely used in SPI mode with microcontrollers - there is a great deal of information just waiting for you both on this website and the wider internet...