problems sending BIN file with XMODEM python - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: problems sending BIN file with XMODEM python (/thread-22699.html) |
problems sending BIN file with XMODEM python - shaya2103 - Nov-23-2019 Hello my freinds, i am trying to send a bin file which i already tested with teraterm before. the reciever is an energy meter, i am connected to it by usb/rs232 converter. when i start the XMODEM i recieve the following error: *Read Byte: b'\x00' send error: expected NAK, CRC, or CAN; got b'\x00'* can anyone please help? i am using the following code: def sendFile(): ser= serialPort.serialport ser.flushInput() print (ser) def getc(size, timeout=8): gbytes = ser.read(size) sleep(2) print(f'Read Byte: {gbytes}') return gbytes or None def putc(data, timeout=8): pbytes = ser.write(data) sleep(2) print(f'Put Byte: {pbytes}') return pbytes or None modem =XMODEM(getc,putc) stream = open('104_new.BIN', 'rb') modem.send(stream) print(stream) |