EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Looking for SD Card code

Started by Donald E Haselwood December 13, 2005
Is there any SPI code for writing with a '9S12 SPI to a SD card I can look at?
If so, it would save me some time sorting out the commands, etc.

Regards,

Donald E Haselwood



There is a company that sells a library to access SD cards from the SPI bus
of the HCS12. Their library will allow you to use FAT formatting on the SD
Card.
www.inmotiondesign.ca

Right now, we use our own library in our systems, but if their library works
well, I think it is worth the price.

If you need the official SD card specification, you will need to purchase
it from the SDCard association at 500$US.
<http://www.sd.org>
If you really want to keep costs to minimum, you can probably use the
Sandisk Multimedia Card specification. The SPI protocol is the same for SDC
and MMC. This document contains enough information to implement a simple SD
Card driver.
http://www.sandisk.com/Assets/File/OEM/Manuals/manual-rs-mmcv1.0.pdf
_____

From: 68HC12@68HC... [mailto:68HC12@68HC...] On Behalf Of
Donald E Haselwood
Sent: December 13, 2005 6:11 PM
To: 68HC12@68HC...
Subject: [68HC12] Looking for SD Card code Is there any SPI code for writing with a '9S12 SPI to a SD card I can look
at?
If so, it would save me some time sorting out the commands, etc.

Regards,

Donald E Haselwood
SPONSORED LINKS
Freescale
<http://groups.yahoo.com/gads?t=ms&k=Freescale+semiconductor+inc&w1=Freescal
e+semiconductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+micr
oprocessor&c=4&s6&.sig=K2HGv-zFlv5OYUv_QxIq_Q> semiconductor inc
Microcontrollers
<http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Freescale+semicondu
ctor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocessor&
c=4&s6&.sig=SYHwNJjjGQXRvtt_GybT4g> Pic
<http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Freescale+semic
onductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microproces
sor&c=4&s6&.sig=umVbbnUwsPzEzKKD_pQfUw> microcontrollers
8051
<http://groups.yahoo.com/gads?t=ms&k51+microprocessor&w1=Freescale+semico
nductor+inc&w2=Microcontrollers&w3=Pic+microcontrollers&w451+microprocess
or&c=4&s6&.sig=NO-nSKjHoAlh9XtZ8LB1_A> microprocessor

_____

> .


_____



In the file section of this group there is a file called
FAT16v2_5.zip
This includes the interface to the SDcard via the SPI port of a HC12.
I will be revisiting this to port it to a HCS08 chip in the next few weeks,
so I'll probably come up with a newly "commented version"/"bug fixes"
within that process.
Hope that helps.
Peter L.

At 06:11 PM 13/12/2005 -0500, you wrote:

>Is there any SPI code for writing with a '9S12 SPI to a SD card I can look
>at?
>If so, it would save me some time sorting out the commands, etc.
>
>Regards,
>
>Donald E Haselwood >
>
>Yahoo! Groups Links >
>
>--
>


--



Hello Donald,

you can download the C code for basic block-level access of MMC and
SD-cards with a HCS12 or 56f8000E dsp at this link:

http://www.flashgenie.net/index.html#code

(it should work with other microprocessors, too, if they have an SPI
interface)

This version does not include the FAT file system as Peter
Lissenburg's project does, but the code would accordingly be much more
compact.

best regards
Robert

--- In 68HC12@68HC..., Donald E Haselwood <dhaselwood@v...> wrote:
>
> Is there any SPI code for writing with a '9S12 SPI to a SD card I
can look at?
> If so, it would save me some time sorting out the commands, etc.
>
> Regards,
>
> Donald E Haselwood
>




Hi

There was an article published in Issue 176 of Circuit Cellar which
implemented a FAT16 on a MSP430 processor, it uses SPI for low level
access, you can download the code from
ftp://ftp.circuitcellar.com/pub/Circuit_Cellar/2005/176/Sham176.zip

The code is targeted at MSP430 processor, you would need to modify
the Hardware Layer Access code to suit the HCS12. Works with most
MMC, and certain SD (Thosiba, SanDisk) cards.

Take note that you would need atleast 1KB RAM buffer as the
MMC "write" is done in 512 bytes.

HTH
Jay --- In 68HC12@68HC..., "joncas04" <happypost@g...> wrote:
>
> Hello Donald,
>
> you can download the C code for basic block-level access of MMC and
> SD-cards with a HCS12 or 56f8000E dsp at this link:
>
> http://www.flashgenie.net/index.html#code
>
> (it should work with other microprocessors, too, if they have an SPI
> interface)
>
> This version does not include the FAT file system as Peter
> Lissenburg's project does, but the code would accordingly be much
more
> compact.
>
> best regards
> Robert
>
> --- In 68HC12@68HC..., Donald E Haselwood <dhaselwood@v...>
wrote:
> >
> > Is there any SPI code for writing with a '9S12 SPI to a SD card I
> can look at?
> > If so, it would save me some time sorting out the commands, etc.
> >
> > Regards,
> >
> > Donald E Haselwood
> >
>




Robert,

Thanks. That is what I was looking for. I plan to try the scheme posted some
time ago where the card has a single file initialized on the PC and the HCS12
then writes to that file.

Regards,

Donald E Haselwood

On Thursday 15 December 2005 01:03, joncas04 wrote:
> Hello Donald,
>
> you can download the C code for basic block-level access of MMC and
> SD-cards with a HCS12 or 56f8000E dsp at this link:
>
> http://www.flashgenie.net/index.html#code
>
> (it should work with other microprocessors, too, if they have an SPI
> interface)
>
> This version does not include the FAT file system as Peter
> Lissenburg's project does, but the code would accordingly be much more
> compact.
>
> best regards
> Robert
>
> --- In 68HC12@68HC..., Donald E Haselwood <dhaselwood@v...> wrote:
> > Is there any SPI code for writing with a '9S12 SPI to a SD card I
>
> can look at?
>
> > If so, it would save me some time sorting out the commands, etc.
> >
> > Regards,
> >
> > Donald E Haselwood
>
> YAHOO! GROUPS LINKS >




Memfault Beyond the Launch