Compact Flash PLD Interfacing

M

mee

Guest
Hi all,
Does anyone know if it would be possible to design a "not-too-complicated"
interface for a PLD to allow writing of data to a Compact Flash card?

I'm currently designing a data logging card where size and power consumption
is an issue. The idea is simple data (in the form of a large quantity of
~60byte words) would be written to the Compact Flash. At the end of the
logging exercise the card could be removed and plugged into a card reader on
a PC and the data retrieved.

We currently require a PLD and I was hoping to get away without having to
put a micro on the board also. All interface examples I have come across to
date tend use a microprocessor as the host interface. Looking at the Compact
Flash standard there are a large number of registers that can be used. My
requirement is very basic and I figure there must be a simple manner of
accessing the memory.

Does anyone know of any good resources on Compact Flash interfacing or have
any opinions on whether the use of a standalone PLD is viable?

Thanks
Mike
 
mee wrote:
Hi all,
Does anyone know if it would be possible to design a "not-too-complicated"
interface for a PLD to allow writing of data to a Compact Flash card?

I'm currently designing a data logging card where size and power consumption
is an issue. The idea is simple data (in the form of a large quantity of
~60byte words) would be written to the Compact Flash. At the end of the
logging exercise the card could be removed and plugged into a card reader on
a PC and the data retrieved.

We currently require a PLD and I was hoping to get away without having to
put a micro on the board also. All interface examples I have come across to
date tend use a microprocessor as the host interface. Looking at the Compact
Flash standard there are a large number of registers that can be used. My
requirement is very basic and I figure there must be a simple manner of
accessing the memory.

Does anyone know of any good resources on Compact Flash interfacing or have
any opinions on whether the use of a standalone PLD is viable?

Thanks
Mike
Hi Mike,

CF has an IDE disk interface. The registers correspond with those
found on a hard disk, which mirrors the historic MFM disk controller
plus several generations of extensions.

You need to implement a quite complex (for a PLD) sequencer to move
data into the CF card.

On top of this, most PC operating systems will require a FAT file
system on the card. This is the main reason why people use
microcontrollers for this. You may be able to get away without a
file system, if you write PC software accessing the device at low
level.

The other problem with CF is that every operation is based on sectors
of 512 Bytes each. Normally, a PLD does not have sufficient memory
blocks to do this. Which PLD are you using?

In my opinion, it is probably possible to store data on a CF card
using a CPLD, but it's not easy and the PLD design will look very
much like a processor anyway.

My recomendation would be to investigate other flash devices. CF
is one of the more difficult ones to drive and has the highest pin
count. Have a look at Atmel's DataFlash chips/cards for instance.

Kind regards,

Iwo
 
Thanks Iwo,
Yes writing to CF looks coplex ... I had thought writing to the card would
be easiest in "memory mode". It would then basically be a matter of writing
to a series of registers on the card the location of where you would like to
write data and then placing the data on the data bus and strobing the write
(I think this is done 512 times to fill the cards buffer). Once full the
contents of the buffer would be written to the requested location in memory.
Easy ... or so I thought! We would probably use an Altera PLD from the
Flex10k or ACEX1k range (~100,000 gates).

I'm really after something that we can remove from the board (in a powered
off state) and download to a PC at a later time (a CF, SD Card, memory
stick, MMC etc with a reader for a PC seemed like the best off the shelf
solution). I'm not sure about Atmel DataFlash you suggested. I couldnt find
a removable card only dicrete ICs - I was hoping to avoid having to design
more than one card and it is necessary to be able to retrieve the data when
the board is powered down (which excludes mounting the flash on the card
permanently). Were you suggesting that Atmel offered removable cards with
the DataFlash devices on it?

Mike

Hi Mike,

CF has an IDE disk interface. The registers correspond with those
found on a hard disk, which mirrors the historic MFM disk controller
plus several generations of extensions.

You need to implement a quite complex (for a PLD) sequencer to move
data into the CF card.

On top of this, most PC operating systems will require a FAT file
system on the card. This is the main reason why people use
microcontrollers for this. You may be able to get away without a
file system, if you write PC software accessing the device at low
level.

The other problem with CF is that every operation is based on sectors
of 512 Bytes each. Normally, a PLD does not have sufficient memory
blocks to do this. Which PLD are you using?

In my opinion, it is probably possible to store data on a CF card
using a CPLD, but it's not easy and the PLD design will look very
much like a processor anyway.

My recomendation would be to investigate other flash devices. CF
is one of the more difficult ones to drive and has the highest pin
count. Have a look at Atmel's DataFlash chips/cards for instance.

Kind regards,

Iwo
 
In article <406ac941@duster.adelaide.on.net>, mee <someone@here.com>
writes
Thanks Iwo,
Yes writing to CF looks coplex ... I had thought writing to the card would
be easiest in "memory mode". It would then basically be a matter of writing
to a series of registers on the card the location of where you would like to
write data and then placing the data on the data bus and strobing the write
(I think this is done 512 times to fill the cards buffer). Once full the
contents of the buffer would be written to the requested location in memory.
Easy ... or so I thought! We would probably use an Altera PLD from the
Flex10k or ACEX1k range (~100,000 gates).
Although you can write into it like this, you won't be able to read it
in a standard PC card reader. You need to implement FAT on the card to
be able to read it with a PC card reader.

--
Tim Mitchell
 
mee wrote:
Thanks Iwo,
Yes writing to CF looks coplex ... I had thought writing to the card would
be easiest in "memory mode". It would then basically be a matter of writing
to a series of registers on the card the location of where you would like to
write data and then placing the data on the data bus and strobing the write
(I think this is done 512 times to fill the cards buffer). Once full the
contents of the buffer would be written to the requested location in memory.
Easy ... or so I thought! We would probably use an Altera PLD from the
Flex10k or ACEX1k range (~100,000 gates).

I'm really after something that we can remove from the board (in a powered
off state) and download to a PC at a later time (a CF, SD Card, memory
stick, MMC etc with a reader for a PC seemed like the best off the shelf
solution). I'm not sure about Atmel DataFlash you suggested. I couldnt find
a removable card only dicrete ICs - I was hoping to avoid having to design
more than one card and it is necessary to be able to retrieve the data when
the board is powered down (which excludes mounting the flash on the card
permanently). Were you suggesting that Atmel offered removable cards with
the DataFlash devices on it?

Mike
I haven't seen them personally, but Atmel says they do:

http://www.atmel.com/dyn/products/devices.asp?family_id=616

Please disregard my comments about the PLD, I had something
like the Coolrunner family in mind. What you plan to use is
probably big enough.

It sounds feasible, but I don't know of anyone who did it.
Let me know how you're getting on.

I went trough a similar selection process a while ago and
in my case I decided that it was easier to use a chip and
move the logger device to the PC instead of a card. I was
size limited, a CF slot would have taken a significant
percentage of the whole device.

Kind regards,

Iwo

Hi Mike,

CF has an IDE disk interface. The registers correspond with those
found on a hard disk, which mirrors the historic MFM disk controller
plus several generations of extensions.

You need to implement a quite complex (for a PLD) sequencer to move
data into the CF card.

On top of this, most PC operating systems will require a FAT file
system on the card. This is the main reason why people use
microcontrollers for this. You may be able to get away without a
file system, if you write PC software accessing the device at low
level.

The other problem with CF is that every operation is based on sectors
of 512 Bytes each. Normally, a PLD does not have sufficient memory
blocks to do this. Which PLD are you using?

In my opinion, it is probably possible to store data on a CF card
using a CPLD, but it's not easy and the PLD design will look very
much like a processor anyway.

My recomendation would be to investigate other flash devices. CF
is one of the more difficult ones to drive and has the highest pin
count. Have a look at Atmel's DataFlash chips/cards for instance.

Kind regards,

Iwo
 
Iwo Mergler <Iwo_dot_Mergler@soton.sc.philips.com> wrote in message news:<NMAac.161$9V3.1390@ns2.gip.net>...
I haven't seen them personally, but Atmel says they do:

http://www.atmel.com/dyn/products/devices.asp?family_id=616
Digikey sells them with 2-8 megs of data. It uses a MMC form factor.
 
It is obvious you are a hardware person.

FAT12/FAT16 is a software problem. Software to a hardware person always
looks complex.

For those who missed my response in another forum, I will repeat it here.


Hi,
The important requirement is:

"At the end of the logging exercise the card could be removed
and plugged into a card reader on a PC and the data retrieved. "

To write one(1) byte of data to a cluster requires writing
3 sectors on the media. The directory, the FAT, and the sector
where the data byte is actually located.
This assumes you formatted the media on a win/dos system
before inserting the card into your system.

If you insert a blank media card into your system, you will be
required to write 3 more sectors. ( now total sectors is 6 )

This is how the FAT file system works, this is how windows and
dos wants, to see the written data as files.

Sending a command to write a sector then the data to be written
is easy.
Its getting all the other stuff figured out is the problem.
Error checking will also need to be done. This is the hardest
part.

A single chip micro is as small as a CPLD and will do what you
want and be far more flexible in getting it done.

There are many MP3 players on the web with code for FAT16/FAT32.

Just google FAT16 to find a project that does what you want to
do. There are many out there.

Once you have a working understanding of what the FAT file
system requires, porting to other platforms is easy.

The hardware is the easiest part of this whole interface.

But, don't underestimate the software requirements.


<http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=fat16&btnG=Google+Search>

<http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&c2coff=1&q=fat16+mp3&btnG=Search>


Good Luck,

hamilton


mee wrote:

Thanks Iwo,
Yes writing to CF looks coplex ... I had thought writing to the card would
be easiest in "memory mode". It would then basically be a matter of writing
to a series of registers on the card the location of where you would like to
write data and then placing the data on the data bus and strobing the write
(I think this is done 512 times to fill the cards buffer). Once full the
contents of the buffer would be written to the requested location in memory.
Easy ... or so I thought! We would probably use an Altera PLD from the
Flex10k or ACEX1k range (~100,000 gates).

I'm really after something that we can remove from the board (in a powered
off state) and download to a PC at a later time (a CF, SD Card, memory
stick, MMC etc with a reader for a PC seemed like the best off the shelf
solution). I'm not sure about Atmel DataFlash you suggested. I couldnt find
a removable card only dicrete ICs - I was hoping to avoid having to design
more than one card and it is necessary to be able to retrieve the data when
the board is powered down (which excludes mounting the flash on the card
permanently). Were you suggesting that Atmel offered removable cards with
the DataFlash devices on it?

Mike


Hi Mike,

CF has an IDE disk interface. The registers correspond with those
found on a hard disk, which mirrors the historic MFM disk controller
plus several generations of extensions.

You need to implement a quite complex (for a PLD) sequencer to move
data into the CF card.

On top of this, most PC operating systems will require a FAT file
system on the card. This is the main reason why people use
microcontrollers for this. You may be able to get away without a
file system, if you write PC software accessing the device at low
level.

The other problem with CF is that every operation is based on sectors
of 512 Bytes each. Normally, a PLD does not have sufficient memory
blocks to do this. Which PLD are you using?

In my opinion, it is probably possible to store data on a CF card
using a CPLD, but it's not easy and the PLD design will look very
much like a processor anyway.

My recomendation would be to investigate other flash devices. CF
is one of the more difficult ones to drive and has the highest pin
count. Have a look at Atmel's DataFlash chips/cards for instance.

Kind regards,

Iwo
 
Hehehe ... yes you are right I am a hardware person! I dont mind software
but in this particular case I was trying to make use of a PLD that we have
to use rather than adding a micro.
As far as FAT and ATA/IDE interfaces that CF uses ... well no I dont have a
good understanding of how they work - I tried a bit of searching for
information but its so hard to find technical sites (that explain them in
detail) in amongst all the commercial and computer sites out there.
For interests sake we have decided to bin the CF idea and add a micro to the
board with a USB connection instead (something we have done before!).
Thanks for your advice!

Mike

"hamilton" <hamilton@deminsional.com> wrote in message
news:406b97a8$1_1@omega.dimensional.com...
It is obvious you are a hardware person.

FAT12/FAT16 is a software problem. Software to a hardware person always
looks complex.

For those who missed my response in another forum, I will repeat it here.


Hi,
The important requirement is:

"At the end of the logging exercise the card could be removed
and plugged into a card reader on a PC and the data retrieved. "

To write one(1) byte of data to a cluster requires writing
3 sectors on the media. The directory, the FAT, and the sector
where the data byte is actually located.
This assumes you formatted the media on a win/dos system
before inserting the card into your system.

If you insert a blank media card into your system, you will be
required to write 3 more sectors. ( now total sectors is 6 )

This is how the FAT file system works, this is how windows and
dos wants, to see the written data as files.

Sending a command to write a sector then the data to be written
is easy.
Its getting all the other stuff figured out is the problem.
Error checking will also need to be done. This is the hardest
part.

A single chip micro is as small as a CPLD and will do what you
want and be far more flexible in getting it done.

There are many MP3 players on the web with code for FAT16/FAT32.

Just google FAT16 to find a project that does what you want to
do. There are many out there.

Once you have a working understanding of what the FAT file
system requires, porting to other platforms is easy.

The hardware is the easiest part of this whole interface.

But, don't underestimate the software requirements.



http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=fat16&btnG=Google+Se
arch>
http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&c2coff=1&q=fat16+m
p3&btnG=Search>
Good Luck,

hamilton


mee wrote:

Thanks Iwo,
Yes writing to CF looks coplex ... I had thought writing to the card
would
be easiest in "memory mode". It would then basically be a matter of
writing
to a series of registers on the card the location of where you would
like to
write data and then placing the data on the data bus and strobing the
write
(I think this is done 512 times to fill the cards buffer). Once full the
contents of the buffer would be written to the requested location in
memory.
Easy ... or so I thought! We would probably use an Altera PLD from the
Flex10k or ACEX1k range (~100,000 gates).

I'm really after something that we can remove from the board (in a
powered
off state) and download to a PC at a later time (a CF, SD Card, memory
stick, MMC etc with a reader for a PC seemed like the best off the shelf
solution). I'm not sure about Atmel DataFlash you suggested. I couldnt
find
a removable card only dicrete ICs - I was hoping to avoid having to
design
more than one card and it is necessary to be able to retrieve the data
when
the board is powered down (which excludes mounting the flash on the card
permanently). Were you suggesting that Atmel offered removable cards
with
the DataFlash devices on it?

Mike


Hi Mike,

CF has an IDE disk interface. The registers correspond with those
found on a hard disk, which mirrors the historic MFM disk controller
plus several generations of extensions.

You need to implement a quite complex (for a PLD) sequencer to move
data into the CF card.

On top of this, most PC operating systems will require a FAT file
system on the card. This is the main reason why people use
microcontrollers for this. You may be able to get away without a
file system, if you write PC software accessing the device at low
level.

The other problem with CF is that every operation is based on sectors
of 512 Bytes each. Normally, a PLD does not have sufficient memory
blocks to do this. Which PLD are you using?

In my opinion, it is probably possible to store data on a CF card
using a CPLD, but it's not easy and the PLD design will look very
much like a processor anyway.

My recomendation would be to investigate other flash devices. CF
is one of the more difficult ones to drive and has the highest pin
count. Have a look at Atmel's DataFlash chips/cards for instance.

Kind regards,

Iwo
 
mee wrote:
Hehehe ... yes you are right I am a hardware person! I dont mind software
but in this particular case I was trying to make use of a PLD that we have
to use rather than adding a micro.
As far as FAT and ATA/IDE interfaces that CF uses ... well no I dont have a
good understanding of how they work - I tried a bit of searching for
information but its so hard to find technical sites (that explain them in
detail) in amongst all the commercial and computer sites out there.
For interests sake we have decided to bin the CF idea and add a micro to the
board with a USB connection instead (something we have done before!).
Thanks for your advice!
Have a look at the FT245BM from FTDI. The chip is USB
on one end and very FPGA-friendly on the other.

From an OS point of view, it's an USB-serial device,
but faster.

Kind regards,

Iwo
 

Welcome to EDABoard.com

Sponsor

Back
Top