Nov-08-2018, 08:21 AM
Dear Larz60+,
tahnks for your quick and important suggestion.
Now, file transfer issue has been completely solved.
As I posted before, debuginfo suggested that sleeping time is changed to 1 s while processing.
Thus finally, sleep(0.001) was modified to sleep(1) in the putc definition section.
The modified code is as follows:
1) xmodem version
The version of xmodem is 0.4.5 which was downloaded from:
https://pypi.org/project/xmodem/
I guess it suppose to be the latest version.
2) Reason to use python2.7
As you may already notice, I have just started to use python.
Python2.7 seems to be pre-installed version for both RaspberryPi and Fedora OS which I usually use.
Thus I recognized that python2.x series is major stream instead of python3.x series.
3) Error traceback
I posted debuginfo which was created by Logger module
instead of standard output on a terminal just in order to provide details including system information.
Now, the problem was sloved but I will attach verbatim error traceback in my next new post.
Again, I would appreciate your kind support.
Best regards.
tahnks for your quick and important suggestion.
Now, file transfer issue has been completely solved.
As I posted before, debuginfo suggested that sleeping time is changed to 1 s while processing.
Thus finally, sleep(0.001) was modified to sleep(1) in the putc definition section.
The modified code is as follows:
import serial import time from xmodem import XMODEM1k, NAK from time import sleep def readUntil(char = None): def serialPortReader(): while True: tmp = port.read(1) if not tmp or (char and char == tmp): break yield tmp return ''.join(serialPortReader()) def getc(size, timeout=1): return port.read(size) def putc(data, timeout=1): port.write(data) sleep(1) port = serial.Serial(port='/dev/ttyUSB0',parity=serial.PARITY_NONE,bytesize=serial.EIGHTBITS,stopbits=serial.STOPBITS_ONE,timeout=0,xonxoff=0,rtscts=0,dsrdtr=0,baudrate=115200) port.write(">\r\n") time.sleep(2) port.write("dat\r\n") time.sleep(1) readUntil(NAK) buffer = open('data', 'wb') XMODEM1k(getc, putc).recv(buffer,crc_mode = 1) readUntil() port.write("end\r\n") port.close()And let me answer your questions.
1) xmodem version
The version of xmodem is 0.4.5 which was downloaded from:
https://pypi.org/project/xmodem/
I guess it suppose to be the latest version.
2) Reason to use python2.7
As you may already notice, I have just started to use python.
Python2.7 seems to be pre-installed version for both RaspberryPi and Fedora OS which I usually use.
Thus I recognized that python2.x series is major stream instead of python3.x series.
3) Error traceback
I posted debuginfo which was created by Logger module
instead of standard output on a terminal just in order to provide details including system information.
Now, the problem was sloved but I will attach verbatim error traceback in my next new post.
Again, I would appreciate your kind support.
Best regards.