Searching \ for '[PIC]: Flash Cards' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/memory.htm?key=flash
Search entire site for: 'Flash Cards'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Flash Cards'
2003\02\27@173940 by Tony Nixon

flavicon
picon face
Hi all,

I am going to use a 16F877 to interface to a Flash Card for a vehicle
data aquisition system. All I need to do is store the data as a single
stream to the memory array and not worry about FAT tables etc. I believe
this is possible.

Has anyone used the USB Flash Card readers? I am concerned that they
expect the cards to be formatted and may not be able to read the data
which has essentially been written in random by the PIC.

--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
spam_OUTsalesTakeThisOuTspambubblesoftonline.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\27@190809 by Andrew Warren

flavicon
face
Tony Nixon <.....PICLISTKILLspamspam@spam@mitvma.mit.edu> wrote:

> Has anyone used the USB Flash Card readers? I am concerned that
> they expect the cards to be formatted and may not be able to read
> the data which has essentially been written in random by the PIC.

Tony:

USB Flashcard readers depend almost universally on a Mass Storage
Class Driver running on the host (PC) side; that driver is included
in recent versions of most popular operating systems.

The driver makes the flashcard reader appear to the PC to be just
another mass-storage device like a hard drive; therefore, the PC will
expect it to be formatted if you use a commercial reader.

If you make your own USB flashcard reader and write your own PC-side
driver, of course, you can write to the flashcard any way you like.

-Andy

=== Andrew Warren -- aiwspamKILLspamcypress.com
=== Principal Design Engineer
=== Cypress Semiconductor Corporation
===
=== Opinions expressed above do not
=== necessarily represent those of
=== Cypress Semiconductor Corporation

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\27@200009 by Ashley Roll

flavicon
face
Hi,

Actually, this is more of an "operating system" level, not really USB
driver. The USB driver just makes it appear like an ordinary hard disk to
the OS, then the application can use the standard OS calls for dealing with
hard disks.

I've done a flash card based MP3 player. In the end I used FAT16 as the file
system, but you can read the raw sectors on the disk. The problem is that
the OS will probably ask if you want to format the disk every time you
insert it unless you can disable that some how..

Under windows NT/2000/XP you can open a drive for direct access to the
sectors. But you do have to have administrator privilege to do it.

You use CreateFile() to open the "hard disk" device directly using the name

\\.\PHYSICALDRIVEx

Where the x is a number. The first drive is 0, then 1, 2 etc..

If you do have a drive letter for the disk, you can also open it as "\\.\C:"
or what ever it is.

You can also use the handle from CreateFile to get device geometry etc using
DeviceIoControl()

Here is some code I've used to raw read a drive. I did this with a flash
card USB reader.. You just need to keep reading the disk or do a
SetFilePointerEx() to set the location to read. Note that you will probably
need to align this on sectors. Most are 512 bytes, but you can check this
using DeviceIoControl().


       char            Buf[512];
       DWORD           dwRead;
       HANDLE  hDrive;
       HRESULT hr;
       //TCHAR tszPath[] = _T("\\\\.\\D:");            // alternative name
       TCHAR           tszPath[] = _T("\\\\.\\PHYSICALDRIVE1");        // second hard disk.

       // attempt to open the drive
       hDrive = CreateFile( tszPath,
                               GENERIC_READ,
                               FILE_SHARE_READ | FILE_SHARE_WRITE,
                               NULL, OPEN_EXISTING, 0, NULL );

       // Make sure it succeeded
       if( NULL != hDrive ) {
               // Read the first sector
               hr = ReadFile( hDrive, Buf, 512, &dwRead, NULL );

               // Make sure the ReadFile was successful
               if( SUCCEEDED(hr) ) {
                       // Buf now contains the data from the first sector.
                       // ... do what ever.
               }

               // close the handle when your done
               CloseHandle( hDrive );
       }

Hope this helps.
Cheers,
Ash.

---
Ashley Roll
Digital Nemesis Pty Ltd
http://www.digitalnemesis.com
Mobile: +61 (0)417 705 718




> {Original Message removed}

2003\02\27@204844 by Tony Nixon

flavicon
picon face
I've just had a quick look at Atmels DataFlash cards.

100 times simpler to interface to and 8Meg is fine for what I need.

Small too 32 x 24mm and connectors are available from Farnell.

--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
.....salesKILLspamspam.....bubblesoftonline.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\27@205702 by Byron A Jeff
face picon face
On Fri, Feb 28, 2003 at 09:38:03AM +1100, Tony Nixon wrote:
> Hi all,
>
> I am going to use a 16F877 to interface to a Flash Card for a vehicle
> data aquisition system. All I need to do is store the data as a single
> stream to the memory array and not worry about FAT tables etc. I believe
> this is possible.
>
> Has anyone used the USB Flash Card readers? I am concerned that they
> expect the cards to be formatted and may not be able to read the data
> which has essentially been written in random by the PIC.

Tony,

It'll probably be more of a headache than it's worth. FAT isn't really all
the complicated and it'll avoid all the application and OS issues on the PC
side.

Why not preformat the card with a single partition, FAT16, with a single root
directory with a single file that takes all of the card's space and feed it
to the PIC. Then you only have to look at one or two fixed spots on the disk
for the 1st data block. Then write away.

It's just that the container is so useful that it may be worth keeping even
though the application doesn't really require it.

BAJ

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\28@172806 by Peter L. Peres

picon face
On Fri, 28 Feb 2003, Tony Nixon wrote:

*>Hi all,
*>
*>I am going to use a 16F877 to interface to a Flash Card for a vehicle
*>data aquisition system. All I need to do is store the data as a single
*>stream to the memory array and not worry about FAT tables etc. I believe
*>this is possible.
*>
*>Has anyone used the USB Flash Card readers? I am concerned that they
*>expect the cards to be formatted and may not be able to read the data
*>which has essentially been written in random by the PIC.

Any card reader expects the card to be 'formatted' but access is at
(fake) sector level and the real responsability for translating data on
the card to files and directories is with the OS. So I do not think that
the card reader cares about the format. It does not care for CF and MMC.

Peter

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

More... (looser matching)
- Last day of these posts
- In 2003 , 2004 only
- Today
- New search...