Shop OBEX P1 Docs P2 Docs Learn Events
BS2 to Sandisk MMC memory card? — Parallax Forums

BS2 to Sandisk MMC memory card?

ArchiverArchiver Posts: 46,084
edited 2002-01-02 12:19 in General Discussion
I've been trying for sometime to interface a Sandisk 16MB
MultiMediaCard with a Parallax Basic Stamp 2 without success.
The 5v Stamp pin signals have been converted to MMC levels (~3.18v)
and using various application documents that I've found,
I think I've got the physical construction right (logic probe looks
good) but it doesn't act exactly the way it should. Specifically:
To power up the card and initialize it into SPI mode (which I need to
use), the documentations says to
1)send at least 74 (80 is suggested) clock pulses
2)set CS pin to LOW
3)send the reset command (CMD0), which is 0x4000 0x0000 0x0095 (I'm
using SHIFTOUT/MSBFIRST)
4)send 8 clock pulse as delay
5)SHIFTIN 8 bit response code
[noparse][[/noparse]until response code is 0x01, keep sending CMD0]
6)8 pulse delay
7)send the init command (CMD1), which is 0x4100 0x0000 0x0000
(SHIFTOUT/MSBFIRST)
8)8 pulse delay
9)SHIFTIN 8 bit response code
[noparse][[/noparse]until response code is 0x00, keep sending CMD1]

At this point, the MMC should be in SPI mode and awaiting a command
to read/write a block of data.
The problem is that I can't get to that point. First, I cannot get
ANY response from the card unless I
send 21 plus a multiple of 25 clock pulses (21, 46, 71, 96, etc...).
When I do that, I can send CMD0
and loop the SHIFTIN of 8bits. This is what is (always in this order)
shifted in:
1) 0111 1110
2) 0000 0011
3) 1111 1111
4) 1111 1111
5) 1111 1111
6) 1111 1111
7) 1111 1111
8) 1111 1111
9) 1111 1110
10)0000 1011
...bytes 3 through 10 then loop indefinitely.

If, instead of looping the SHIFTIN, I continue sending CMD0 in order
to get the 0x01 response code, I never get it.
If I just continue on to issuing CMD1, the same thing happens which
is shifting in that loop of blocks 3 through 10
as if it's ignoring my CMD0 and CMD1 commands.

I think I've exhaused every PDF and HTML document I could find on the
subject and I'm hoping someone might
have had the same problem and figured it out.
ANY HELP IS APPRECIATED!!!

thanks
Jim Swensen
[noparse][[/noparse]jswensen*volcanomail,com]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-12-31 12:03
    At 11:03 AM 12/31/2001 +0000, you wrote:
    >I've been trying for sometime to interface a Sandisk 16MB
    >MultiMediaCard with a Parallax Basic Stamp 2 without success.
    >The 5v Stamp pin signals have been converted to MMC levels (~3.18v)
    >and using various application documents that I've found,
    >I think I've got the physical construction right (logic probe looks
    >good) but it doesn't act exactly the way it should. Specifically:
    >To power up the card and initialize it into SPI mode (which I need to
    >use), the documentations says to
    >1)send at least 74 (80 is suggested) clock pulses
    >2)set CS pin to LOW
    >3)send the reset command (CMD0), which is 0x4000 0x0000 0x0095 (I'm
    >using SHIFTOUT/MSBFIRST)
    >4)send 8 clock pulse as delay
    >5)SHIFTIN 8 bit response code
    >[noparse][[/noparse]until response code is 0x01, keep sending CMD0]
    >6)8 pulse delay
    >7)send the init command (CMD1), which is 0x4100 0x0000 0x0000
    >(SHIFTOUT/MSBFIRST)
    >8)8 pulse delay
    >9)SHIFTIN 8 bit response code
    >[noparse][[/noparse]until response code is 0x00, keep sending CMD1]
    Jim -

    Try setting CS LOW right from the get go. With CS LOW on power-up the MMC is
    automatically in SPI Mode. Hopefully that will get you started in the right
    direction.

    Just as a matter of curiosity, how are you intending to overcome the
    (seeming) requirement of 512 byte reads ?

    Regards,

    Bruce Bates
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-31 18:20
    You might check this out;
    http://www.compsys1.com/workbench/On_top_of_the_Bench/MMC_Project/mmc_pr
    oject.html

    On 31 Dec 2001 at 15:31, basicstamps@yahoogroups.com wrote:

    > I think I've exhaused every PDF and HTML document I could find on the
    > subject and I'm hoping someone might have had the same problem and figured
    > it out. ANY HELP IS APPRECIATED!!!
    >
    > thanks
    > Jim Swensen
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-01 06:07
    Thanks Bruce and Mike
    Mike, that's a cool site but I couldn't find any technical details. I
    don't want to ask them for "trade secrets" if they're selling it.

    Bruce, in playing around with then number of clock pulses and the
    whether I sample data right before the "first" pulse or the "second"
    pulse, I've found that if I run 96 clock pulses, set CS to low, send
    CMD0, I do indeed get my 0x01 as the second byte of info.
    When I power up with CS low, I get data but I can't get that 0x01!
    Reverting back to CS low after power up, the problem now is that when
    I try to issue CMD1, I get 0x101 which is to be expected when an
    invalid CMD is issued. I don't know what is wrong with my CMD1 since
    it takes no arguments and CRC isn't even turned on.
    I've read that some old MMCs aren't manufactured to enter SPI mode,
    only MMC mode even though the specifications call for it. The
    information was dated early 2000, so I'm hoping that if that was the
    case, it is no longer. It's all very frustrating.
    But to answer your question, with the exception of Hitachi MMCs
    (according to their documentation), the MMC can be set for variable
    block lengths to write. Default is 512 bytes. If that doesn't work
    for me, I guess I'll have to use a buffer chip.

    Jim
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-01 16:09
    Jim
    Give Milford Instruments in the UK a call. I don't have their number to
    hand, but download their catalogue..
    www.milinst.com/fullcat.pdf
    ..they sell something called a Megastor, which is a small devt board,
    sandisk 16Mb card
    and BS2 working source code.
    Costs about 50UKP.
    Hope that helps if you can't solve it free!
    Regards
    Les


    Original Message
    From: jswensen500 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=raiJX0XAOfcFsheCDcFVtMZ7aCzwFzT3oiwsP65cFuXlpH1Vsal0io4wbaYQI5iUDku0hzkfjw_LbbBoqw]jswensen500@y...[/url
    Sent: 31 December 2001 11:03
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] BS2 to Sandisk MMC memory card?


    I've been trying for sometime to interface a Sandisk 16MB
    MultiMediaCard with a Parallax Basic Stamp 2 without success.
    The 5v Stamp pin signals have been converted to MMC levels (~3.18v)
    and using various application documents that I've found,
    I think I've got the physical construction right (logic probe looks
    good) but it doesn't act exactly the way it should. Specifically:
    To power up the card and initialize it into SPI mode (which I need to
    use), the documentations says to
    1)send at least 74 (80 is suggested) clock pulses
    2)set CS pin to LOW
    3)send the reset command (CMD0), which is 0x4000 0x0000 0x0095 (I'm
    using SHIFTOUT/MSBFIRST)
    4)send 8 clock pulse as delay
    5)SHIFTIN 8 bit response code
    [noparse][[/noparse]until response code is 0x01, keep sending CMD0]
    6)8 pulse delay
    7)send the init command (CMD1), which is 0x4100 0x0000 0x0000
    (SHIFTOUT/MSBFIRST)
    8)8 pulse delay
    9)SHIFTIN 8 bit response code
    [noparse][[/noparse]until response code is 0x00, keep sending CMD1]

    At this point, the MMC should be in SPI mode and awaiting a command
    to read/write a block of data.
    The problem is that I can't get to that point. First, I cannot get
    ANY response from the card unless I
    send 21 plus a multiple of 25 clock pulses (21, 46, 71, 96, etc...).
    When I do that, I can send CMD0
    and loop the SHIFTIN of 8bits. This is what is (always in this order)
    shifted in:
    1) 0111 1110
    2) 0000 0011
    3) 1111 1111
    4) 1111 1111
    5) 1111 1111
    6) 1111 1111
    7) 1111 1111
    8) 1111 1111
    9) 1111 1110
    10)0000 1011
    ...bytes 3 through 10 then loop indefinitely.

    If, instead of looping the SHIFTIN, I continue sending CMD0 in order
    to get the 0x01 response code, I never get it.
    If I just continue on to issuing CMD1, the same thing happens which
    is shifting in that loop of blocks 3 through 10
    as if it's ignoring my CMD0 and CMD1 commands.

    I think I've exhaused every PDF and HTML document I could find on the
    subject and I'm hoping someone might
    have had the same problem and figured it out.
    ANY HELP IS APPRECIATED!!!

    thanks
    Jim Swensen
    [noparse][[/noparse]jswensen*volcanomail,com]


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-01 20:26
    Really? He has a schematic, describes the need for an EEPROM because the MMC
    requires 512 byte writes and has PicBasic source code. Mr. Diol is on the
    PicBasic
    list and I don't think he is selling it.
    He used a PIC at 3.3V to avoid the buffering.
    On 1 Jan 2002 at 17:45, basicstamps@yahoogroups.com wrote:
    > Thanks Bruce and Mike
    > Mike, that's a cool site but I couldn't find any technical details. I
    > don't want to ask them for "trade secrets" if they're selling it.
    >

    ......
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-02 06:03
    No, not really. You're right. I've been going through so many
    websites looking for information on this that I only scanned through
    looking for specific words and phrases and didn't pay enough
    attention. After reading your message, I went back and the code
    immediately jumped in front of my face. The only problem is that it's
    written for a PIC16F876 with an external eeprom and I don't initially
    see where his initialization process is different from mine. So I'm
    going through the code and changing it to my configuration and
    hopefully even if I don't see a difference in the CODE, I'll see a
    difference in the output.

    Thanks for the heads up!



    --- In basicstamps@y..., "Mike DeMetz" <miked@t...> wrote:
    > Really? He has a schematic, describes the need for an EEPROM
    because the MMC
    > requires 512 byte writes and has PicBasic source code. Mr. Diol is
    on the PicBasic
    > list and I don't think he is selling it.
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-02 06:09
    Thanks Les,
    You know, that was one of the first websites I found while
    researching whether or not to try this project. Seeing the picture of
    the Megastor convinced me that I could do it (a few headaches
    notwithstanding). I feel that I'm very close to getting this nut
    cracked, and that's what is maddening about these obstacles.
    If I can't get it done then I'm going to send MI an order for one!

    Jim


    --- In basicstamps@y..., "Les Otter" <lesotter@s...> wrote:
    > Jim
    > Give Milford Instruments in the UK a call. I don't have their
    number to
    > hand, but download their catalogue..
    > www.milinst.com/fullcat.pdf
    > ..they sell something called a Megastor, which is a small devt
    board,
    > sandisk 16Mb card
    > and BS2 working source code.
    > Costs about 50UKP.
    > Hope that helps if you can't solve it free!
    > Regards
    > Les
    >
    >
    >
    Original Message
    > From: jswensen500 [noparse][[/noparse]mailto:jswensen500@y...]
    > Sent: 31 December 2001 11:03
    > To: basicstamps@y...
    > Subject: [noparse][[/noparse]basicstamps] BS2 to Sandisk MMC memory card?
    >
    >
    > I've been trying for sometime to interface a Sandisk 16MB
    > MultiMediaCard with a Parallax Basic Stamp 2 without success.
    > The 5v Stamp pin signals have been converted to MMC levels (~3.18v)
    > and using various application documents that I've found,
    > I think I've got the physical construction right (logic probe looks
    > good) but it doesn't act exactly the way it should. Specifically:
    > To power up the card and initialize it into SPI mode (which I need
    to
    > use), the documentations says to
    > 1)send at least 74 (80 is suggested) clock pulses
    > 2)set CS pin to LOW
    > 3)send the reset command (CMD0), which is 0x4000 0x0000 0x0095 (I'm
    > using SHIFTOUT/MSBFIRST)
    > 4)send 8 clock pulse as delay
    > 5)SHIFTIN 8 bit response code
    > [noparse][[/noparse]until response code is 0x01, keep sending CMD0]
    > 6)8 pulse delay
    > 7)send the init command (CMD1), which is 0x4100 0x0000 0x0000
    > (SHIFTOUT/MSBFIRST)
    > 8)8 pulse delay
    > 9)SHIFTIN 8 bit response code
    > [noparse][[/noparse]until response code is 0x00, keep sending CMD1]
    >
    > At this point, the MMC should be in SPI mode and awaiting a command
    > to read/write a block of data.
    > The problem is that I can't get to that point. First, I cannot get
    > ANY response from the card unless I
    > send 21 plus a multiple of 25 clock pulses (21, 46, 71, 96, etc...).
    > When I do that, I can send CMD0
    > and loop the SHIFTIN of 8bits. This is what is (always in this
    order)
    > shifted in:
    > 1) 0111 1110
    > 2) 0000 0011
    > 3) 1111 1111
    > 4) 1111 1111
    > 5) 1111 1111
    > 6) 1111 1111
    > 7) 1111 1111
    > 8) 1111 1111
    > 9) 1111 1110
    > 10)0000 1011
    > ...bytes 3 through 10 then loop indefinitely.
    >
    > If, instead of looping the SHIFTIN, I continue sending CMD0 in order
    > to get the 0x01 response code, I never get it.
    > If I just continue on to issuing CMD1, the same thing happens which
    > is shifting in that loop of blocks 3 through 10
    > as if it's ignoring my CMD0 and CMD1 commands.
    >
    > I think I've exhaused every PDF and HTML document I could find on
    the
    > subject and I'm hoping someone might
    > have had the same problem and figured it out.
    > ANY HELP IS APPRECIATED!!!
    >
    > thanks
    > Jim Swensen
    > [noparse][[/noparse]jswensen*volcanomail,com]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@y...
    > from the same email address that you subscribed. Text in the
    Subject and
    > Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2002-01-02 12:19
    I have a brand new MegaStore for sale. I bought 2, but only used one. The
    other is brand new sealed. I will sell it to you for a bit cheaper than
    Milford.

    P.S. Contact me at my email if you are interested. rryerson@o...

    Richard

    Original Message
    From: "jswensen500" <jswensen500@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Wednesday, January 02, 2002 1:09 AM
    Subject: [noparse][[/noparse]basicstamps] Re: BS2 to Sandisk MMC memory card?


    >
    > Thanks Les,
    > You know, that was one of the first websites I found while
    > researching whether or not to try this project. Seeing the picture of
    > the Megastor convinced me that I could do it (a few headaches
    > notwithstanding). I feel that I'm very close to getting this nut
    > cracked, and that's what is maddening about these obstacles.
    > If I can't get it done then I'm going to send MI an order for one!
    >
    > Jim
    >
    >
    > --- In basicstamps@y..., "Les Otter" <lesotter@s...> wrote:
    > > Jim
    > > Give Milford Instruments in the UK a call. I don't have their
    > number to
    > > hand, but download their catalogue..
    > > www.milinst.com/fullcat.pdf
    > > ..they sell something called a Megastor, which is a small devt
    > board,
    > > sandisk 16Mb card
    > > and BS2 working source code.
    > > Costs about 50UKP.
    > > Hope that helps if you can't solve it free!
    > > Regards
    > > Les
    > >
    > >
    > >
    Original Message
    > > From: jswensen500 [noparse][[/noparse]mailto:jswensen500@y...]
    > > Sent: 31 December 2001 11:03
    > > To: basicstamps@y...
    > > Subject: [noparse][[/noparse]basicstamps] BS2 to Sandisk MMC memory card?
    > >
    > >
    > > I've been trying for sometime to interface a Sandisk 16MB
    > > MultiMediaCard with a Parallax Basic Stamp 2 without success.
    > > The 5v Stamp pin signals have been converted to MMC levels (~3.18v)
    > > and using various application documents that I've found,
    > > I think I've got the physical construction right (logic probe looks
    > > good) but it doesn't act exactly the way it should. Specifically:
    > > To power up the card and initialize it into SPI mode (which I need
    > to
    > > use), the documentations says to
    > > 1)send at least 74 (80 is suggested) clock pulses
    > > 2)set CS pin to LOW
    > > 3)send the reset command (CMD0), which is 0x4000 0x0000 0x0095 (I'm
    > > using SHIFTOUT/MSBFIRST)
    > > 4)send 8 clock pulse as delay
    > > 5)SHIFTIN 8 bit response code
    > > [noparse][[/noparse]until response code is 0x01, keep sending CMD0]
    > > 6)8 pulse delay
    > > 7)send the init command (CMD1), which is 0x4100 0x0000 0x0000
    > > (SHIFTOUT/MSBFIRST)
    > > 8)8 pulse delay
    > > 9)SHIFTIN 8 bit response code
    > > [noparse][[/noparse]until response code is 0x00, keep sending CMD1]
    > >
    > > At this point, the MMC should be in SPI mode and awaiting a command
    > > to read/write a block of data.
    > > The problem is that I can't get to that point. First, I cannot get
    > > ANY response from the card unless I
    > > send 21 plus a multiple of 25 clock pulses (21, 46, 71, 96, etc...).
    > > When I do that, I can send CMD0
    > > and loop the SHIFTIN of 8bits. This is what is (always in this
    > order)
    > > shifted in:
    > > 1) 0111 1110
    > > 2) 0000 0011
    > > 3) 1111 1111
    > > 4) 1111 1111
    > > 5) 1111 1111
    > > 6) 1111 1111
    > > 7) 1111 1111
    > > 8) 1111 1111
    > > 9) 1111 1110
    > > 10)0000 1011
    > > ...bytes 3 through 10 then loop indefinitely.
    > >
    > > If, instead of looping the SHIFTIN, I continue sending CMD0 in order
    > > to get the 0x01 response code, I never get it.
    > > If I just continue on to issuing CMD1, the same thing happens which
    > > is shifting in that loop of blocks 3 through 10
    > > as if it's ignoring my CMD0 and CMD1 commands.
    > >
    > > I think I've exhaused every PDF and HTML document I could find on
    > the
    > > subject and I'm hoping someone might
    > > have had the same problem and figured it out.
    > > ANY HELP IS APPRECIATED!!!
    > >
    > > thanks
    > > Jim Swensen
    > > [noparse][[/noparse]jswensen*volcanomail,com]
    > >
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@y...
    > > from the same email address that you subscribed. Text in the
    > Subject and
    > > Body of the message will be ignored.
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
Sign In or Register to comment.