I am trying to send a file (image .jpg in this case) via the serial port.
It currently works by calling an external script:
subprocess.Popen(['./sendFile.sh','myImage.jpg']).communicate()
where sendFile.sh:
cp /home/pi/$1 /dev/ttyAMA0
This method works, but is somehow unstable. Sometimes my Python program stops after file transfer.
I am wondering if there is a way to do this in Python instead of calling the script for reference? I searched for XMODEM, but it looks like both ends should install it. I am sending an image to a GPRS chip that does not allow me to change any code on it. Therefore, installing something on the receiving side is not possible.
source
share