0

I am trying to do firmware upgrade for a module. For this I have been trying to send a binary file(.rps file) via XMODEM protocol in python, in Windows.

I have tried the code in the below link: https://pypi.org/project/xmodem/

I am not receiving any response from the module, not the firmware is upgraded.

This image represents, the output I am getting when I print size and data from xmodem code Can I get some help on this!

YAMI
  • 1
  • 1
  • Maybe the baud rate (or other serial port parameter) is wrong? Maybe there's some command that needs to be sent to put the device into firmware upgrade mode? Maybe there's some preprocessing (such as decompression) that has to be done to the file before you send it? You haven't given us enough details for us to even know what further details to ask for. – jasonharper Nov 11 '21 at 14:31
  • I have entered the command to send the module into firmware upgrade mode. I have verified that with sp.read(). The baud rate is 115200. The code I have tried is: sp = serial.Serial('COM2',baudrate=115200,timeout=0.05) def getc(size, timeout=8): gbytes = sp.read(size) #print(f'Read Byte: {gbytes}') return gbytes or None def putc(data, timeout=8): pbytes = sp.write(data) #print(f'Put Byte: {pbytes}') modem = XMODEM(getc, putc) print(modem) filename="test_file.rps" stream = open(filename, 'rb') modem.send(stream) – YAMI Nov 12 '21 at 13:30
  • Please provide enough code so others can better understand or reproduce the problem. – Community Nov 13 '21 at 11:41
  • I am using a proprietary wifi module, hence the code is reserved for it. However I can assure you that it works fine until the xmodem part! Main motto is to transfer a file from PC to serial port. I have tried to do it with .txt as well. However the output is the same as the image I added in the main post. – YAMI Nov 15 '21 at 05:54

0 Answers0