f



building a card reader into a virtex 2 or 5 based FPGA device.

Sorry to start from scratch yet again, but I don't know where to
begin.

In the past I've had log file info dump out onto  a UART as
necessary.  The UART is slow, and requires an additional device to
capture the datastream.

I want to be able to write to a removable memory stick, or compact
flash card, but I don't have any idea how to do it.  When the FPGA is
powered up it should start a new "file" on the compact flash card, and
start writing to it.  On commanded bit or powerdown, the file should
be closed, and stored such that I can pull the card, plug it into a PC
and read the file with notepad or such.


The fpga should be able to read a small config file, and then write it
back out, for example a file with the filename in it

logfilen.txt:
0000000
--------------------------

the fpga reads the line ( 0000000 ) and knows filename should be that
plus one say 0000001.txt
and then it updates/rewrites/deletes and posts a

logfilen.txt:
00000001

this way the filenames of the log files keeps changing.


I'm looking for ideas on how to get this accomplished.

Thanks,

Jon





0
jon291 (71)
7/21/2009 7:56:52 PM
comp.arch.fpga 18580 articles. 2 followers. Post Follow

6 Replies
369 Views

Similar Articles

[PageSpeed] 30

On Jul 21, 3:56=A0pm, jleslie48 <j...@jonathanleslie.com> wrote:
> Sorry to start from scratch yet again, but I don't know where to
> begin.
>
> In the past I've had log file info dump out onto =A0a UART as
> necessary. =A0The UART is slow, and requires an additional device to
> capture the datastream.
>
> I want to be able to write to a removable memory stick, or compact
> flash card, but I don't have any idea how to do it. =A0When the FPGA is
> powered up it should start a new "file" on the compact flash card, and
> start writing to it. =A0On commanded bit or powerdown, the file should
> be closed, and stored such that I can pull the card, plug it into a PC
> and read the file with notepad or such.
>
> The fpga should be able to read a small config file, and then write it
> back out, for example a file with the filename in it
>
> logfilen.txt:
> 0000000
> --------------------------
>
> the fpga reads the line ( 0000000 ) and knows filename should be that
> plus one say 0000001.txt
> and then it updates/rewrites/deletes and posts a
>
> logfilen.txt:
> 00000001
>
> this way the filenames of the log files keeps changing.
>
> I'm looking for ideas on how to get this accomplished.
>
> Thanks,
>
> Jon

If you wanted to use CompactFlash, you could use Xilinx'x SystemAce
chip and their libraries for interfacing to it with an embedded
processor like Microblaze or the PowerPC. If you wanted to roll your
own CF interface, it's basically an IDE interface, so you might be
able to find the spec and go at it, or find a free core on
opencores.org.

If you wanted to use Secure Digital, you can do that with a SPI
interface to implement the sector reads/writes and find some FAT32
code to put on top of in, of course in an embedded processor. There's
also a product called DosOnChip which takes care of a lot of the
filesystem stuff for you: http://www.sparkfun.com/commerce/product_info.php=
?products_id=3D8215

Hope this gives you some ideas.

Dave
0
Dave
7/22/2009 12:38:59 AM
jleslie48 <jon@jonathanleslie.com> writes:

> Sorry to start from scratch yet again, but I don't know where to
> begin.
>
> In the past I've had log file info dump out onto  a UART as
> necessary.  The UART is slow, and requires an additional device to
> capture the datastream.
>

How fast do you need? FTDIs UART-USB (TTL-232R-3V3) cable will go @
3Mbps IIRC.  It's an extra cable, hardly a device though, unless you
count the PC as well?

http://apple.clickandbuild.com/cnb/shop/ftdichip?productID=53&search=usb+uart+cable&op=catalogue-product_info-null

> I want to be able to write to a removable memory stick, or compact
> flash card, but I don't have any idea how to do it.  When the FPGA is
> powered up it should start a new "file" on the compact flash card, and
> start writing to it.  On commanded bit or powerdown, the file should
> be closed, and stored such that I can pull the card, plug it into a PC
> and read the file with notepad or such.

Is this sort of thing any use?

http://www.vinculum.com/

Easy modules:
http://apple.clickandbuild.com/cnb/shop/ftdichip?op=catalogue-products-null&prodCategoryID=57&title=VDIP1

I've never used them, but it looks like a simple way to add use-storage
to a system.

Failing that, glue a USB host controller on the side and run linux on a
microblaze.

[BTW, even though I sound like an FTDI salesman I have no affiliation
with FTDI, other than having used various of their products!]

Cheers,
Martin

-- 
martin.j.thompson@trw.com 
TRW Conekt - Consultancy in Engineering, Knowledge and Technology
http://www.conekt.net/electronics.html
0
Martin
7/22/2009 10:38:35 AM
Martin Thompson <martin.j.thompson@trw.com> wrote:
> jleslie48 <jon@jonathanleslie.com> writes:

> > Sorry to start from scratch yet again, but I don't know where to
> > begin.
> >
> > In the past I've had log file info dump out onto  a UART as
> > necessary.  The UART is slow, and requires an additional device to
> > capture the datastream.
> >

> How fast do you need? FTDIs UART-USB (TTL-232R-3V3) cable will go @
> 3Mbps IIRC.  It's an extra cable, hardly a device though, unless you
> count the PC as well?

If you go with the FT245 or FT2232 in 245 mode, rate can even be higher, at
the cost of more pins. Requirements on the PC side are the same.
-- 
Uwe Bonnes                bon@elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
0
Uwe
7/22/2009 12:06:43 PM
On Wed, 22 Jul 2009 12:06:43 +0000 (UTC), Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
wrote:

>Martin Thompson <martin.j.thompson@trw.com> wrote:
>> jleslie48 <jon@jonathanleslie.com> writes:
>
>> > Sorry to start from scratch yet again, but I don't know where to
>> > begin.
>> >
>> > In the past I've had log file info dump out onto  a UART as
>> > necessary.  The UART is slow, and requires an additional device to
>> > capture the datastream.
>> >
>
>> How fast do you need? FTDIs UART-USB (TTL-232R-3V3) cable will go @
>> 3Mbps IIRC.  It's an extra cable, hardly a device though, unless you
>> count the PC as well?
>
>If you go with the FT245 or FT2232 in 245 mode, rate can even be higher, at
>the cost of more pins. Requirements on the PC side are the same.

And the FT2232H/4232H devices will go even faster...
0
Mike
7/22/2009 5:12:24 PM
On Jul 22, 6:38 am, Martin Thompson <martin.j.thomp...@trw.com> wrote:
> jleslie48 <j...@jonathanleslie.com> writes:
> > Sorry to start from scratch yet again, but I don't know where to
> > begin.
>
> > In the past I've had log file info dump out onto  a UART as
> > necessary.  The UART is slow, and requires an additional device to
> > capture the datastream.
>
> How fast do you need? FTDIs UART-USB (TTL-232R-3V3) cable will go @
> 3Mbps IIRC.  It's an extra cable, hardly a device though, unless you
> count the PC as well?
>
> http://apple.clickandbuild.com/cnb/shop/ftdichip?productID=53&search=...
>
> > I want to be able to write to a removable memory stick, or compact
> > flash card, but I don't have any idea how to do it.  When the FPGA is
> > powered up it should start a new "file" on the compact flash card, and
> > start writing to it.  On commanded bit or powerdown, the file should
> > be closed, and stored such that I can pull the card, plug it into a PC
> > and read the file with notepad or such.
>
> Is this sort of thing any use?
>
> http://www.vinculum.com/
>
> Easy modules:http://apple.clickandbuild.com/cnb/shop/ftdichip?op=catalogue-product...
>
> I've never used them, but it looks like a simple way to add use-storage
> to a system.
>
> Failing that, glue a USB host controller on the side and run linux on a
> microblaze.
>
> [BTW, even though I sound like an FTDI salesman I have no affiliation
> with FTDI, other than having used various of their products!]
>
> Cheers,
> Martin
>
> --
> martin.j.thomp...@trw.com
> TRW Conekt - Consultancy in Engineering, Knowledge and Technologyhttp://www.conekt.net/electronics.html

Ok, I'm looking at these solutions, they look promising, but has
anyone actually got one of these to work?

I've got a Diligent test board and it has a compact flash reader on
it, so I'm assuming someone actually used this reader for something,
but I can't find any test code or any clue how to use it.  I keep
hearing something about microblaze, and then I can write C code, but I
have yet to stumble onto an example.

0
jleslie48
7/23/2009 7:06:21 PM
On Jul 23, 3:06=A0pm, jleslie48 <j...@jonathanleslie.com> wrote:
> On Jul 22, 6:38 am, Martin Thompson <martin.j.thomp...@trw.com> wrote:
>
>
>
>
>
>
>
> > jleslie48 <j...@jonathanleslie.com> writes:
> > > Sorry to start from scratch yet again, but I don't know where to
> > > begin.
>
> > > In the past I've had log file info dump out onto =A0a UART as
> > > necessary. =A0The UART is slow, and requires an additional device to
> > > capture the datastream.
>
> > How fast do you need? FTDIs UART-USB (TTL-232R-3V3) cable will go @
> > 3Mbps IIRC. =A0It's an extra cable, hardly a device though, unless you
> > count the PC as well?
>
> >http://apple.clickandbuild.com/cnb/shop/ftdichip?productID=3D53&search=
=3D...
>
> > > I want to be able to write to a removable memory stick, or compact
> > > flash card, but I don't have any idea how to do it. =A0When the FPGA =
is
> > > powered up it should start a new "file" on the compact flash card, an=
d
> > > start writing to it. =A0On commanded bit or powerdown, the file shoul=
d
> > > be closed, and stored such that I can pull the card, plug it into a P=
C
> > > and read the file with notepad or such.
>
> > Is this sort of thing any use?
>
> >http://www.vinculum.com/
>
> > Easy modules:http://apple.clickandbuild.com/cnb/shop/ftdichip?op=3Dcata=
logue-product...
>
> > I've never used them, but it looks like a simple way to add use-storage
> > to a system.
>
> > Failing that, glue a USB host controller on the side and run linux on a
> > microblaze.
>
> > [BTW, even though I sound like an FTDI salesman I have no affiliation
> > with FTDI, other than having used various of their products!]
>
> > Cheers,
> > Martin
>
> > --
> > martin.j.thomp...@trw.com
> > TRW Conekt - Consultancy in Engineering, Knowledge and Technologyhttp:/=
/www.conekt.net/electronics.html
>
> Ok, I'm looking at these solutions, they look promising, but has
> anyone actually got one of these to work?
>
> I've got a Diligent test board and it has a compact flash reader on
> it, so I'm assuming someone actually used this reader for something,
> but I can't find any test code or any clue how to use it. =A0I keep
> hearing something about microblaze, and then I can write C code, but I
> have yet to stumble onto an example.

For just datalogging, where throughput isn't too important, I'd
personally go with an SD card, using the SPI mode of communication.
There are several examples of C code for controlling an SD card with
the SPI interface, such as http://www.flashgenie.net/index.html#code.
There are some examples of FAT32 code floating around on the net, too.

The SD card association at www.sdcard.org also publishes a simplified
spec which shows a lot of the SPI commands you can use with SD cards.

You can find some breakout boards for SD cards at www.sparkfun.com,
and tie them to your Digilent board if it has an IO header that goes
to the FPGA.

If the CF card on your board is connected to a Xilinx SystemAce chip,
then it might be fairly simple to use with an embedded processor.
Otherwise, you'll either have to learn the IDE spec or find some IP to
handle it. There's an IDE controller on opencores.org, but I have no
experience with it.

You could also use one of the USB/UART solutions that have been
proposed, and have the computer to the logging. You'd need to be
tethered to a computer, but it would be super-fast to implement.

Good luck,
Dave
0
Dave
7/24/2009 2:46:27 AM
Reply: