image from serial camera doesn't upload the full image to FTP server via GPRS

I have a problem which is when I try to upload an image that the serial camera has taken size(13kb) the image that will be uploaded is only (8kb) but when I try to upload the image on the sd card without using the serial camera the image is fullly uploaded(13kb).

Full code of my project is on the attachment

Full Code beta.ino (25.3 KB)

Did you specify binary mode in your FTP?

Sorry for this answer but I dont know how to do that...If the image to be uploaded must be (13kb) and the file that is uploaded is (8kb) only the file is not corrupted I just see the image in half.

IMAGE28.JPG

IMAGE28.JPG

Sorry for this answer but I dont know how to do that...If the image to be uploaded must be (13kb) and the file that is uploaded is (8kb) only the file is not corrupted I just see the image in half.

In this case take a look at the server log file to find the error in the transfer.

Did you check that the image from the serial camera was correctly stored on the SD card?

Print out the size of the file on the SD card at the time you send it by FTP. Check if that size differs from the size the actual file on the card has.

pylon:
In this case take a look at the server log file to find the error in the transfer.

Did you check that the image from the serial camera was correctly stored on the SD card?

Print out the size of the file on the SD card at the time you send it by FTP. Check if that size differs from the size the actual file on the card has.

Thanks for the replies, yes the image is correctly stored. The size of the file to be uploaded and the file size from the SD card is the same the problem is in the uploading process

if I use this kind of logic

void camera()
{
capture image

gprsUpload();

}

gprsUpload()
{
uploads the file but when it reach 8-9kb the uploading will stop
}

but if I used this

string image="image00.jpg"; //the image that the serial camera has taken

then I will just skip the camera process then I will upload the file directly

gprsUpload()
{
uploads the file completely
}

I dont know what is wrong but is it something with the serial buffer, does it affect when I used the serial camera it gets full?

f I use this kind of logic

void camera()
{
capture image

gprsUpload();

}

gprsUpload()
{
uploads the file but when it reach 8-9kb the uploading will stop
}

but if I used this

string image="image00.jpg"; //the image that the serial camera has taken

then I will just skip the camera process then I will upload the file directly

gprsUpload()
{
uploads the file completely
}

I don't understand what the relevant difference in the two pseudo code parts is. If the second one works but the first one doesn't work, why do you stop after 8kB? And why is the file size on the server still correct? Am I correct that the posted code shows the second version? If that's correct, why are you posting the code that works but not the code that doesn't work?

I dont know what is wrong but is it something with the serial buffer, does it affect when I used the serial camera it gets full?

That's probably not a problem with the buffer but with the horrible way SoftwareSerial is implemented. The complete processor is blocked and interrupts are disabled while a complete byte is received or sent. As the cam is operated at 38400 baud it might send 2 bytes while the GSM sends one and at least one byte of these two is lost.

I would rethink your project and remove the SoftwareSerial instance if ever possible. If you think you need an instance of it, use it for a device that is seldom used and for which you can ensure that no other device will send anything at the same time.