[En-Nut-Discussion] Example using UFLASH filesystem
Ulrich Prinz
uprinz2 at netscape.net
Wed Oct 27 23:00:05 CEST 2010
Hi
Sorry, but that wasn't me...
It was more or less simple as you just register the bus, the memory and
then the file-system... But I never got that far as I mostly write low
level drivers or port new chips for Nut/OS... :)
Ah, got it (I love Mozilla):
Thread is "how to use AT45DB serial Dataflash and filesysem"
And Ole gave the answer:
------------8<----------
I just have a very simple example how to mount the filesystem. But when
mounted you can just use it like any other filesystem with some
limitations like the fact that directories are not realy implemented.
The mounting itself is indeed quite different from the mounting of e.g.
MMC devices.
The following function mounts the dataflash attached to SPI Bus 0,
Chipselect 0. If you want to connect the dataflash to another SPI bus or
chipselect change
flashAt45dib0 ==> flashAt45dibX for the chipselect
spiBus0At91 ==> spiBusXAt91 for the SPI Bus accordingly
int init_dataflash(void)
{
if (UFlashAttach(&devUFlash0, &flashAt45dib0, &spiBus0At91)) {
puts("Attaching serial flash failed");
}
if (NutRegisterDevice(&devUFlash0, 0, 0)) {
puts("Mounting UFLASH0 failed");
} else {
puts("Mounting UFLASH0: OK!");
}
return 0;
}
In this sample I supposed you use the AT91 SPI Bus driver. Take any
other SPI Bus driver for your board as needed.
To open a file just use the fopen call below:
fd = fopen("UFLASH0:my_file.txt", "r+b");
A clean / empty filesystem consists of all pages in the flash cleared
(factory default). To "format" (clear) the flash you can use
UFlashFormat(&devUFlash0, &flashAt45dib0, &spiBus0At91);
------------>8----------
May be someone can put that into the Wiki...
And may be we can promote the Wiki a bit more obvious ?
Best regards
Ulrich
Am 27.10.2010 21:23, schrieb Coleman Brumley:
> Remi,
>
> Not handy, but there was a great tutorial posted to this mailing list a few
> months ago -- it should be in the archives.
>
> I believe Ulrich posted the step by step. It sounds like something that
> should go into the wiki.
>
> Coleman
>
> -----Original Message-----
> From: en-nut-discussion-bounces at egnite.de
> [mailto:en-nut-discussion-bounces at egnite.de] On Behalf Of Remi Bilodeau
> Sent: Wednesday, October 27, 2010 12:55 PM
> To: en-nut-discussion at egnite.de
> Subject: [En-Nut-Discussion] Example using UFLASH filesystem
>
> Someone have example how to use UFLASH filesystem with AT45DB161 dataflash??
>
> Thank!
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
More information about the En-Nut-Discussion
mailing list