I started playing around with my ALFAT developer kit and I am having difficulties. What I would like to do is to read/write data to the flash card in the ALFAT with a PC in addition to being able to read/write data with my micro-controller in the system.
Is there a way to have the ALFAT system show up as a drive on the PC side that I can go in and manipulate files?
Insert your flash card, init ALFAT by “I U1:D” (I don’t remember exactly), then file system will be shown in PC if connected. Refer ALFAT 2.0 docuemt for more details
This command will change USB port 1 from HOST to Device.
Insert flash sd before calling this command.
At this time ALFAT has another function same as SD Card reader. Is this what you wanted?
I see now what you are talking about and have picked up a few of the commands for the ALFAT. I can initialize an SD card, initialize the files and folders (somewhat), and open a file and assign a handle to it.
But now I am stuck at how to read and write to the file. For example I put a file on the SD card named “ANALOGG.CSV” and am able to open it for reading/writing but I am confused as to how I can get/put important information on the SD card. So in the ALFAT Explorer I have:
I M: [strong]!00[/b]
O 1R>M:\ANALOGG.CSV !00
R 1Z>10 !00
ZZZZZZZZZZ$00000000
But this file is pre-loaded with a bunch of different values that I want to read. Am I doing something wrong here or can ALFAT not read the contents of my file?
Also, if you could clarify the write process for me that would be awesome. This is what I entered into the ALFAT Explorer:
O 1W>M:\ANALOGG.CSV !00
W 1>10 !00
1100110011
$10 (at this point I pressed “Read Line” multiple times before realizing I was doing something wrong)
$00001010 (I wanted to write 10 numbers (1100110011) so I figured 00001010 is binary for 10) $00000010 !00 !02 (I tried to “Read Line” again)
C 1 !00
After this I tried to read it back and had moderate success:
O 1R>M:\ANALOGG.CSV !00
R 1x>00001010 (again I figured 00001010 is binary for 10 and that is how many characters I wanted read back to me) !00 1100110011
I’m not exactly sure how many X’s but it’s a lot (I can’t copy and paste from the text box). So it looked like I successfully wrote to the file and read it back. Except that the file I was opening already had information in it that I would rather read and write over.
Thank you for all your help Dat, I think I am getting close to accomplishing what I want with the ALFAT file system. Here is what I need to do now:
I would like to read/write data to files on a CompactFlash card (or any other form of flash storage if necessary). These files are loaded with 100 seperate values in a .CSV format. In the experiment below I tried to retrieve data from a file through ALFAT but all I get back is filler characters when I should have received data I pre-loaded into the card.
Ideally, what I need to do is go into one of my files (such as ANALOGG.CSV) and pull out one of the values (ie. the 55th value) which will be used by a microprocessor. Is that possible or will I need to read the entire file?
having no knowledge of ALFAT, I would do the “smarts” of reading the 55th value (or whatever) in the microcontroller. That’s just a set of read commands, and intelligently parsing the data. ALFAT to me is a storage abstraction layer, and it’d be unusual to have file content parsing capability there, so deal with that outside the storage layer.
[quote]
In the experiment below I tried to retrieve data from a file through ALFAT but all I get back is filler characters when I should have received data I pre-loaded into the card.[/quote]
Are you saying ALFAT gave you data that is different with data in your file? Some software will show data in character, example instead of 97, it can be shown character ‘a’ but actually they are one.
[quote]
Ideally, what I need to do is go into one of my files (such as ANALOGG.CSV) and pull out one of the values (ie. the 55th value) which will be used by a microprocessor. Is that possible or will I need to read the entire file?[/quote]
You can do that if you know where its location is. Use ‘P’ - file seek to jump to anywhere you want in that file.
Yes I had information in the file I was using above (100 seperate values) but when I tried to read it I only got place holders.
Then I wrote to the file as described above, which ALFAT read back to me. Do you think it could be some type of error with the format of the files or we need another driver of some sort?
I will attempt to use the P command, otherwise I’m sure we can work something out using the processor to obtain the correct data within a file.
[quote]Then I wrote to the file as described above, which ALFAT read back to me. Do you think it could be some type of error with the format of the files or we need another driver of some sort?
I will attempt to use the P command, otherwise I’m sure we can work something out using the processor to obtain the correct data within a file.[/quote]
ALFAT does not know, also does not care what format of the file is. ALFAT also does not care the file contents.
What interface are you using? I mean SPI, UART or I2C?