Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
P is for Practical
 
PerlMonks  

Read/Write to an MMC card

by IanVand (Initiate)
on Apr 26, 2012 at 18:10 UTC ( #967424=perlquestion: print w/ replies, xml ) Need Help??
IanVand has asked for the wisdom of the Perl Monks concerning the following question:

I currently have a project where I need to read/write information to an MMC card (SD card). Does Perl have the power to do this? If so, where do I get started? Any help would be greatly appreciated.

Comment on Read/Write to an MMC card
Re: Read/Write to an MMC card
by SuicideJunkie (Priest) on Apr 26, 2012 at 18:32 UTC

    Put the card in a reader, and then either mount it like any other block device, or wait for windows to assign it a drive letter. Use it the same way as any other removable storage device.

Re: Read/Write to an MMC card
by zentara (Archbishop) on Apr 26, 2012 at 19:10 UTC
    Not really a Perl question, but to help you out:

    It will most likely work like a USB Key drive. If you are on Linux, look at the tail of /var/log/messages for an entry after you put the SD card in it's reader. It will tell you which device was found and it's identifier. Something like:

    sb 1-3: new high speed USB device using ehci_hcd and address 4 kernel: [ 1181.921444] usb 1-3: New USB device found, kernel: [ 1182.925597] sd 9:0:0:0: Attached scsi generic sg3 type 0 kernel: [ 1184.324359] sd 9:0:0:0: [sdc] 7936000 512-byte logical bloc +ks: (4.06 GB/3.78 GiB) kernel: [ 1184.379333] sd 9:0:0:0: [sdc] Attached SCSI removable disk
    So looking at it, you will have /dev/sdc, so all you need to do to read it, is as root: system( "mount -t vfat /dev/sdc1 /mnt/mySDcard");

    Normally these cards have only 1 partition and are formatted vfat, but you could have something different.

    Once that mount command finishes, your SD filesystem will be in your /mnt/mySDcard, for you to write or read from. You can make any mountpoint you desire, and most systems have an Automounter daemon going and will mount your card automatically wherever it is designed to do it, usually somewhere under /mnt. You can type the command "mount" to see where the various filesystems get mounted by the Automounter daemon. Only root can do the mount command, so you may need to use sudo, or log in as root.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: Read/Write to an MMC card
by IanVand (Initiate) on Apr 26, 2012 at 20:39 UTC

    I'm sorry for not being more specific with my question. I want to write to a specific memory address on the MMC card.

    It would be great if I could send JEDEC commands to the MMC card using Perl.

    The JEDEC specification is here: http://www.jedec.org/standards-documents/docs/jesd84-b45

      So let's think this over a bit...

      Your initial question was quite reasonable: a "can Perl do this?" But now it looks like you may have had a bit more in mind... and a rather incomplete problem statement.

      It's the difference between "Can I drive a Corvette to the moon?" and "Given a launch vehicle able to power a sufficiently capacious transport module, can I send a 'vette to the moon?"

      Then, you give us an address, but not as a link. To make it a link, you need to enclose it in square brackets: [ ... ] -- see What shortcuts can I use for linking to other information?.

      Then the site turns out to require registration.

      Are you expecting us to write your code, as well?

      That's not how PM works. You write code... and when it doesn't do what you want, you post the offending code; tell us how it failed to satisfy you; quote any error messages or warnings, verbatim; and tell us -- concisely but comprehensively -- what you're trying to accomplish.

      Then we have the prerequisites to help.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://967424]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2014-04-16 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (422 votes), past polls