Hello,
I’m trying to use ChaN’s FatFS with the interface provided by Martin
Thomas on my AT91SAM7S256, but the “data write” part gives me a
headache.
Before going into details, first of all thanks very much to ChaN and
Martin for their work, I really appreciate it.
OK, besides FatFs I have FreeRTOS installed, one main task and one
“write to SD-card” task. The task structure seems to work, no problems
in the past. In Martin’s interface I have deactivated DMA, since for
some reason it didn’t work. I didn’t want to dig deeper, my application
also works without DMA.
Using FatFS to create, open and close files works perfectly. The only
problem is when I want to write data to the SD-card continuously (not
only one sector). In many cases it works, but every now and then various
interrupts fire (spurious, DABT, UDEF etc).
I have used Martin’s example application as basis, my test code looks
somewhat like that:
BYTE buff_test[4*2] _attribute_ ((aligned (4)));
UINT byte_written, byte_len;
unsigned int i = 0;
res = f_open(&File1, FileName, FA_OPEN_ALWAYS | FA_WRITE);
res2 = f_lseek(&File1, File1.fsize);
(Continuous loop until “stop” button is pressed)
{
for (i=0; i<=3;i++) buff_test[i]=i;
byte_len = sizeof(buff_test);
res3 = f_write(&File1, buff_test, byte_len, &byte_written);
}
res4 = f_close(&File1);
f_mount(0, NULL);
I must admit that I have no deeper knowledge of the _attribute_
command. In case this is the reason for my code to crash, do you have
any sample code to show how to input “integer”- and “long”-type data
correctly into above described array structure?
Once this problem is fixed, I want both tasks to access the
SPI-interface to communicate with different external devices.
Christian
P.S.: I have to apologize in advance in case somebody answers too
quickly: I will be away for the next 8 days.
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.