Main Site Documentation

Multiple file write using append


#1

Hi!

I am trying to write 1000 bytes of data in four blocks. I use the following sequence:
1> Mount the drive on U0
2>Open file for append
3>Send write command for 1000 bytes
4>Send 1000 data bytes
5>Flush file
6>Close file

I repeat the step 2 to step 6 four times. In the first loop the file is written properly, but in the second step I do not receive any acknowledge after step 4 is executed. I have checked my code number of times but the same error exists. Kindly help me in finding a right method to complete the project.


#2

@ amol -

What interface are you using?

SPI, UART, I2C?

How about in the second step, try on another file?


#3

Hi,

Sorry for replying late, I was on leave.

I am using UART interface and at baud rate 921600,8,n,1
When I set the baud rate to 115200 then the board works fine. On any other baud rate data is not always written. and error 02 is returned when I try to open file for append.

Kindly help as my project is getting delayed and this card is playing lot of tricks on me.

Thanks
Amol


#4

@ amol -

You need to switch baud rate from 115200 to 921600 by B command
Find it in ALFAT’s user maunual


#5

Hi

I am doing the baud rate change. Initially baud rate for my hardware is 115200, then I issue B command to change Baud rate to 931600 like “B E3710” I get no error. Then I change baud rate of controller to 931600. After that I send “I” command to Init and mount the device; still no error. Then I open file for append with “O” command, still no error.
Then I send “W” command to write 1000 bytes, no error received. Then I send 1000 bytes and wait for acknowledgement from Alfat. I get no response. But when I send 50 or 60 bytes extra I get the response that Alfat has received 1000 bytes. So I need to sent more then 1000 bytes to get the response back. My question now is:

1> Why Alfat needs more bytes than the actual to generate a response, there is no error when baud rate is 115200?
2> how many stop bits are needed by Alfat.
3> What precautions do I need to take while running Alfat at high baud rates?

Thanks
Amol


#6

@ amol -

931600 is not too high with ALFAT because it can be up to3Mb.

Try to send 1000 bytes at 115200 first, make sure everything works OK then switch to 931600.