polpla,
Have you been able to implement the SD write using DMA? I think that function would be great for an audio recording project I'm working on.
polpla,
Have you been able to implement the SD write using DMA? I think that function would be great for an audio recording project I'm working on.
Another question, has anyone had trouble getting the library to work on the mini? I changed the CS to 7 in the SD2card.cpp file, and still a no go.
Has the latest code been posted? Looking at http://code.google.com/p/maple-sdfat/ , it looks as though the most recent checkins were well before the "1700kB/s" post.
erg144, not sure whats going on there. can you give a few more details like your system config and your source?
hndgas what do you mean by nogo? Are you able to talk to the card or the SPI transactions arnt happening at all, or they are happening but CS is not toggling? I have not ever tried with a mini, but perhaps I will in the near future and post here.
So once again I ask silly questions like has anyone actually used this successfully after the leaflabs blog
declared it working? I am not liking the consistancy of my maple experience.
If I add the following to the fileSys demo.
//...
root.ls(LS_DATE | LS_SIZE);
// open a file
if (file.open(&root, "LOG01.txt", O_READ))
{
SerialUSB.println("Opened PRINT00.TXT");
}
if (file.open(&root, "WRITE00.TXT", O_WRITE))
{
SerialUSB.println("Opened WRITE00.TXT");
}
I get the following...
card.init passed
volume.init passed
openRoot passed
9512649.848265 2012-01-14 13:22:48 4096
76696784858269.748071 2008-12-01 18:19:06 87646
84826583726912649/ 2012-01-14 13:22:48
70836986697812649/ 2012-01-14 13:22:48
83807984767312649/ 2012-01-14 13:22:48
95766967848512649.748071 2012-01-14 13:25:06 4096
77658375.748071 2008-12-01 18:14:50 1959
957765837512649.748071 2012-01-14 13:25:16 4096
6769736812649 1980-01-01 00:00:00 108
67696865846512649/ 1980-01-01 00:00:00
70826571516812649.778051 2012-01-14 13:27:48 3167212
file.open failed
Clearly it can read the filesystem and I can fix the weirdness. I am mostly kind of bummed that another YES it works! doesn't seem to.
Hell is other peoples code...
(Edit: gbulmer added code quotes)
You've probably fixed this already, but a quick fix for the numbers instead of characters bug, edit the file FatStructs.h (in the maple SD library) and change the line indicated:-
struct directoryEntry {
/**
* Short 8.3 name.
* The first eight bytes contain the file name with blank fill.
* The last three bytes contain the file extension with blank fill.
*/
char name[11]; <------ Change this line from uint8(or whatver it was) to char so humans can read it.
The file open failed *might* be because you don't have a file named LOG01.txt or WRITE00.txt
on your sd card? It happens ;)
higwoshy - <>char name[11]; <------ Change this line from uint8(or whatver it was) to char so humans can read it.
</>
I'm not sure I understand the comment 'so humans can read it'. Using char
might be wrong.
char
is not necessarily the same as uint8
.
uint8
should be defined as unsigned char
, but char
might be signed or unsigned depending on the compiler default, and compiler flags.
So if there is code which depends on the exact type, uint8
, or unsigned char, might be essential, and char
might break the code.
The correct ANSI C type is uint8_t
, which is defined in stdint.h
(Full disclosure: I am not a member of LeafLabs staff)
My C was a long,long time ago, and I've only just started up programming again, so little bits like this tend to go unnoticed on my part. The problem was that instead of characters, the print function was printing out numbers, and no amount of persuading it would change that. Is there a print( n, ASCII)? Like print(n, HEX). Of course, I could just cast to char for each print in the SD library, but there were a few so I figured it would be easier just to change the single line rather than lots of lines.
Ok, just a done a quick test and both unsigned char and signed char for serialIUSB.print, print out numbers whereas char prints out a character (same for uint8, uint8_t)
That seems a bit strange to me? Shouldn't printing a char (signed or unsigned) result in an ascii character, or am I missing something?
Shouldn't printing a char (signed or unsigned) result in an ascii character, ...?
No, not in C, and not necessarily :-(
In C, char
, unsigned char
, and signed char
are all integer types, so the rules are they are 'widened' to an int size and hence are indistinguishable from an int
.
C++ is able to tell that a char is a char, but it seems that in libmaple it must be ASCII-clean to work. (IMHO this decision is a bit USA-centric :-(
See the documentation at http://leaflabs.com/docs/lang/api/serialusb.html#lang-serialusb
IIRC, write(n);
will send the binary value of an unsigned char.
Arduino uses print(n, BYTE);
which is unambiguous, and sends the byte, but I can't find it in the documentation or libmaple library source.
Well that change fixes it.
What are the odds we could get that committed to the repository so the next person doesn't go through this.
Thanks,
Don.
Spoke too soon. Looking at the code i am seeing the commenting out all of the arduino specific code and then leaving the lazy hard-coding of arduino's chip select and other not very kind things there. The chip select is different depending on the spi port and breaks pretty fantastically if you are testing on the stock maple and implementing on a maple mini. I will fix some of this and send you a pull request. My feeling here in general here is that this library port isn't ready for prime time and more work should be done on porting a more recent sd card library (like the one lady ada is using at present).
I've been scouting about for a STM32F1 compatible FAT16/32 library for a project I want to work on soon, which caused me to find this thread! Before buying a Maple (OK, an Olimexino) I found this product page over at Sparkfun: http://www.sparkfun.com/products/8627
I'm not sure which library their work is based off yet as I've not had a chance to look through yet, but it may be worth a look. It's worth noting that they have an issue at 115200 baud that might be built-in if the code is ported directly.
The logomatic is what my project is designed to replace. (My client also wanted something that could call home). The libraries aren't too bad but the logomatic code itself is pretty poorly written (lots of magic number f00) and a complete waste of an arm7. The fixes the maple-sdfat for the two things that would make this library work have been submitted as issue on github (http://code.google.com/p/maple-sdfat/issues/list) and the solutions are to simple to bother forking it. I will probably look at porting the SD library after I get the gainspan stuff running.
Fair enough - I'll stop looking at the code over there as an alternative! Thanks for the heads-up.
I did wonder what the ARM7 would be doing too (apart from 'not much most of the time')...
I was excited to use the logomatic until i realize what a pile the code was. On the other hand it's nice to work with a 5 dollar arm instead of a 15 dollar arm. Its also nice to not have to start from scratch and figure out all of the register foo that libmaple does well. On the other other hand it's not always so nice to have to deal with a lot of the less well written code in the arduino code.
The client just asked for fat32 support so I am going to stick with the maple-sdfat for now and if the issues don't get sorted out in the original or if there is enough interest I may fork it.
You must log in to post.