maximum time spent in while loop ?

Hi all,

I'm just wondering how many times does the µC can waits inside a while loop before the watchdog of it quits this while loops ?

I'm asking this because i'm streaming a file directly from the SD card and it seems that when the file is bigger than 50kB, the while loop ends !
Is this problem related with the watchdog or do i have to look further in my code for finding my mistake ?

Thanks !

Did you do anything to explicitly turn the watchdog on?

CrossRoads:
Did you do anything to explicitly turn the watchdog on?

Hi,

Errr ... Definitely not !
But i can confirm that when i strem a file from the µSD slot, if the file excess some size, the stream stops by itself on a regular basis.

EDIT : Please forgive me about my question ... I put a timeout earlier in my code for closing connection if there is no activity during 3000ms.
You can hit me if you want/need hahaha :grin:

EDIT2 : ERRATUM !!! I think the problem is linked to the SD library.
-> I removed the timeout on my function and it continues to end at the same filesize transmitted.

simkard:
EDIT2 : ERRATUM !!! I think the problem is linked to the SD library.
-> I removed the timeout on my function and it continues to end at the same filesize transmitted.

My function actually looks this code :

while (dataFile.available()){
   TEMP_SD_READ_BYTE = dataFile.read();
   HTTP_CLIENT.print(TEMP_SD_READ_BYTE);
}

The while loop ends systematicaly and respectively on the same file size for each file i try to download :
a GIF file : 12980 bytes
a JPG file : 20304 bytes

The speed of the connexion is ~5 ko/s.

I'm wondering if the command "dataFile.available()" is not running too fast and not permitting the result to update itself and becoming, at least, more than 1.

EDIT : i tried to add a "delay(1);" at the end, before the while loop ... loops, and then, i have to exact same problem (except that the result takes longer to obtain).
-> I'm definitely thinking there must be some kind of problem with the SD library.

I'm definitely thinking there must be some kind of problem with the SD library.

99.9% of the time the problem is in the application code, while it does happen it's very unusual to find a bug a library.

~5 ko/s.

? 1000 ohms per second?

Where are you putting all this data?

add a "delay(1);" at the end, before the while loop ... loops,

We're not clairvoyant, how about you post all the code?


Rob

For now i'm working on a HTTP server with far more features than webduino that lacks a lot (for me, at least ;)) of features.

When my code captures the client HTTP REQUEST, it has to answer to it after interpreting the contents.
When this is all done, it gathers the file to serve and send the HTTP HEADERS related to this file (content-length ; content-type; etc ...)

While the code serves the file, it stops @ some random file-size but systematically the same repectively for each file.

The code is exactly the one i provided (for the part where i serves the file).
There is no (upper in the code) while loops or anything that could do some timeout on the request.

So, i don't understand why it is just happening !

I will try to do the same without the whole code for trying the behavior.

I'll get back soon ...

Which SD library are you using?

http://code.google.com/p/sdfatlib/

This one, or something else?

CrossRoads:
Which SD library are you using?

Google Code Archive - Long-term storage for Google Code Project Hosting.

This one, or something else?

The one included in Arduino's IDE 0022 and 0023, souldn't i ? :roll_eyes:

Try the other one than.

BillG does a lot of work maintaining it.

http://code.google.com/u/110949153210107887426/

I'll give it a shot ...