[AVR] Writing or using a UART bootloader.   - Page 1
Forum section: electronics / general

author: Sudo_apt-get_install_yum
author_rank: Regular Contributor
timestamp: July 12, 2021, 08:52:47 am
content: Hello everyone!Like the title says, I’m looking to add a bootloader to my project but would like some input since I’ve never done such a thing.Goal:The goal of the bootloader is to safely update the main program code over the UART. The update should be able to be performed by a PC or by a PLC and should be as easy as to use as possible.Just send the bytes from the PC, the bootloader responds with "ACK/NACK" if the checksum adds up and then it continues.Problems:One of the problems is that I’ve never written a bootloader, it does seem quite straight forward and looking at existing ones on GitHub makes it seem rather unremarkable. The thing is that I would prefer a tested bootloader that is known to work well instead of creating one from scratch and possibly introducing bugs that would require a reflash to fix.The second problem is that the processor (ATMega328P) communicates over RS485 with a RS232 to RS485 transceiver and an extra pin is used for flow control. The processor does not have a hardware configurable flow control pin like most modern processor, so the communication direction must be controlled through software. This is however an easy things to do.Possible bootloaders:So I’ve done some searching on the internet for possible bootloaders to use but haven’t found a bootloader that would work right out of the box.OptiBoot seems to be the most robust opensource bootloader, but I don’t like that it is made for Arduino. It emulates the STK500 which is nice but seems rather extensive for what I need, not completely sure how il write an STK500 programming interface for a PLC.Another downside/upside is that it’s a very extensive bootloader with somewhat lacking documentation that has support for loads of processors and configurations, i just need it to work on one processor and make it as simple as possible to use/understand. At first glance, OptiBoot does not support "custom" entry/calling the bootloader from the main program, something id like to do.https://github.com/Optiboot/optibootMagBoot is another alternative, its not as commonly used but seems good. Its a very stripped-down bootloader which is nice. I’ve done a re-write of this bootloader to make it work for my application and it seems to work (not done any extensive testing). There are things I don’t like with it so if I decide to go for a custom bootloader il use it as a reference and write one from scratch. This bootloader doesn’t really have any documentation but is small and easy to understand.https://github.com/blastur/magbootThere are tons of bootloader on the internet so I’m not sure which one to use or if il write one from scratch.It seems rather unnecessary to write one from scratch and I would like to avoid it so as not to introduce a bug that would require a complete reflash to correct. But id also not want to use a online bootloader that has some bug in it either. I’ve done some searching on the web and in this forum/avrfreaks but haven’t found a definitive answer.Any input is appreciated!

author: madires
author_rank: Super Contributor
timestamp: July 12, 2021, 09:34:34 am
content: Improved OptiBoot:https://github.com/kubi48/avr-assembler-optiboot

author: Sudo_apt-get_install_yum
author_rank: Regular Contributor
timestamp: July 13, 2021, 03:05:25 pm
content: Thanks for the recommendation, skimmed through it and it seems to be pretty good and well documented!Il definitively keep it in mind.Id still prefer a stripped down bootloader since I don’t need the portability or configurability of the OptiBoot variants. Being able to compile it for every AVR processor and clock configuration is a bit overkill for my use case. "Keep it simple stupid".I did some quick testing with the regular OptiBoot and got it running on my board but couldn’t get the RS485 flow control to work, will do some more testing but still think the OptiBoot bootloader is a bit overkill.

author: Sudo_apt-get_install_yum
author_rank: Regular Contributor
timestamp: July 14, 2021, 12:18:20 pm
content: Not sure if its okey to ask a questing in my thread or if I should start a new one. It is however related.Like i mentioned earlier, I’ve been doing some testing with OptiBoot.I noticed that the Bill Westfield (project maintainer) had added RS485 support in commitbcc71438fe.... (16 days ago)https://github.com/Optiboot/optiboot/commit/bcc71438fe23e43ce95f1347844400050bf4cdb6Its working and I’m able to send/receive data from within the bootloader but its refusing to program for some reason and I’m not sure why.Below is the verbose output from Arduino IDECode:C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM4 -b115200 -D -Uflash:w:C:\Users\USER~1.STR\AppData\Local\Temp\arduino_build_968772/Blink.ino.hex:iavrdude: Version 6.3-20190619Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/Copyright (c) 2007-2014 Joerg WunschSystem wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"Using Port : COM4Using Programmer : arduinoOverriding Baud Rate : 115200AVR Part : ATmega328PChip Erase delay : 9000 usPAGEL : PD7BS2 : PC2RESET disposition : dedicatedRETRY pulse : SCKserial program mode : yesparallel program mode : yesTimeout : 200StabDelay : 100CmdexeDelay : 25SyncLoops : 32ByteDelay : 0PollIndex : 3PollValue : 0x53Memory Detail :Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xffflash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xfflfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00Programmer Type : ArduinoDescription : Arduinoavrdude: stk500_recv(): programmer is not respondingavrdude: stk500_recv(): programmer is not respondingHardware Version: 4744608Firmware Version: 8.4611299avrdude: stk500_recv(): programmer is not respondingavrdude: stk500_recv(): programmer is not respondingavrdude: stk500_recv(): programmer is not respondingVtarget : 420030.5 VVaref : 0.3 VOscillator : 921.600 kHzSCK period : 18594687.6 usavrdude: stk500_recv(): programmer is not respondingavrdude: stk500_recv(): programmer is not respondingavrdude: stk500_initialize(): failedavrdude: initialization failed, rc=-1Double check connections and try again, or use -F to overridethis check.avrdude done. Thank you.Problem uploading to board. See https://support.arduino.cc/hc/en-us/sections/360003198300 for suggestions.Below is the sniffed communication between the computer and the target device.Code:[14/07/2021 13:04:17] - Open port COM4 (C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude.exe)[14/07/2021 13:04:18] Written data (COM4)30 20[14/07/2021 13:04:18] Read data (COM4)14 10[14/07/2021 13:04:19] Written data (COM4)30 20[14/07/2021 13:04:19] Read data (COM4)14 10[14/07/2021 13:04:19] Written data (COM4)30 20[14/07/2021 13:04:19] Read data (COM4)14 10[14/07/2021 13:04:19] Written data (COM4)41 80 20[14/07/2021 13:04:29] Written data (COM4)41 81 20[14/07/2021 13:04:29] Read data (COM4)14 08 10[14/07/2021 13:04:29] Written data (COM4)41 82 20[14/07/2021 13:04:39] Written data (COM4)41 98 20[14/07/2021 13:04:39] Read data (COM4)14 03 10[14/07/2021 13:04:39] Written data (COM4)41 84 20[14/07/2021 13:04:49] Written data (COM4)41 85 20[14/07/2021 13:04:49] Read data (COM4)14 03 10[14/07/2021 13:04:49] Written data (COM4)41 86 20[14/07/2021 13:04:59] Written data (COM4)41 87 20[14/07/2021 13:04:59] Read data (COM4)14 03 10[14/07/2021 13:04:59] Written data (COM4)41 89 20[14/07/2021 13:05:09] Written data (COM4)41 81 20[14/07/2021 13:05:09] Read data (COM4)14 08 10[14/07/2021 13:05:09] Written data (COM4)41 82 20[14/07/2021 13:05:19] Written data (COM4)42 86 00 00 01 01 01 01 03 ff ff ff ff 00 80 0400 00 00 80 00 20[14/07/2021 13:05:19] Read data (COM4)14 10[14/07/2021 13:05:19] Written data (COM4)45 05 04 d7 c2 00 20[14/07/2021 13:05:29] Written data (COM4)51 20[14/07/2021 13:05:29] Read data (COM4)14 10[14/07/2021 13:05:29] - Close port COM4I’m looking through the AVR061 appnote and working on figuring out the issue but I’m not completely sure just yet.Any input is appreciated!

author: westfw
author_rank: Super Contributor
timestamp: July 15, 2021, 06:06:48 am
content: I didn’t so much “add” rs485 support as merge code that someone else had written.I noticed that it doesn’t quite work the way that I’d like, and also that making it work “better” is “tricky”. :-(There’s an open issue wrt rs485 in optiboot_x that says that some rs485 adapters work better than others.(What adapter are you using, and what is generating that nice debug output? That debug info seems to show correct responses, but avrdude doesn’t seem to see them. (Try adding more -v options to get more debugging. I think -vvvv is the max))

author: Sudo_apt-get_install_yum
author_rank: Regular Contributor
timestamp: July 15, 2021, 07:29:07 am
content: Yeah, noticed that you added it from the tiny core (i linked the working commit).Also noticed that there was a similar issuehttps://github.com/Optiboot/optiboot/issues/318but for the "x" core and didn’t want to high-jack the issue so posted here. Was also not completely sure if I had compiled it incorrectly since it’s my first attempt at OptiBoot.The adapter I’m using is thehttps://www.sparkfun.com/products/9822, based on theFTDI FT232RLbridge, it’s been working with the exact setup for a long time but i know that a few buddies of mine have had issues with the driver for it.I’m not sure how to change the output log in Arduino, I’m not too experienced with the backend of Arduino. So I used the "regular" AVRDUDE with the Arduino config.The program i used to sniff the serial communication is called "Advanced serial port monitor"https://www.com-port-monitoring.com/and is in "Dump view". The program cost but there is a free trial.The command used for avr-dude.Code:./avrdude.exe -C "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -vvvv -p atmega328p -c arduino -P COM4 -b 115200AVR-DUDE output:Code:avrdude.exe: Version 6.3-20190619Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/Copyright (c) 2007-2014 Joerg WunschSystem wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"Using Port : COM4Using Programmer : arduinoOverriding Baud Rate : 115200avrdude.exe: Send: 0  avrdude.exe: Send: 0  avrdude.exe: Send: 0  avrdude.exe: Recv: . avrdude.exe: Recv: . AVR Part : ATmega328PChip Erase delay : 9000 usPAGEL : PD7BS2 : PC2RESET disposition : dedicatedRETRY pulse : SCKserial program mode : yesparallel program mode : yesTimeout : 200StabDelay : 100CmdexeDelay : 25SyncLoops : 32ByteDelay : 0PollIndex : 3PollValue : 0x53Memory Detail :Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xffBlock Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xffBlock Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00Programmer Type : ArduinoDescription : Arduinoavrdude.exe: Send: A  .  avrdude.exe: ser_recv(): programmer is not respondingavrdude.exe: stk500_recv(): programmer is not respondingavrdude.exe: Send: A  .  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Send: A  .  avrdude.exe: ser_recv(): programmer is not respondingavrdude.exe: stk500_recv(): programmer is not respondingavrdude.exe: Send: A  .  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Recv: . Hardware Version: 4744608Firmware Version: 8.4611299avrdude.exe: Send: A  .  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Send: A  .  avrdude.exe: ser_recv(): programmer is not respondingavrdude.exe: stk500_recv(): programmer is not respondingavrdude.exe: Send: A  .  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Send: A  .  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Send: A  .  avrdude.exe: ser_recv(): programmer is not respondingavrdude.exe: stk500_recv(): programmer is not respondingVtarget : 0.3 VVaref : 197035782.4 VOscillator : 28.800 kHzSCK period : 17531493.1 usavrdude.exe: Send: A  .  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Send: A  .  avrdude.exe: ser_recv(): programmer is not respondingavrdude.exe: stk500_recv(): programmer is not respondingavrdude.exe: Send: B  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Send: E  .  .  .  .  .  avrdude.exe: ser_recv(): programmer is not respondingavrdude.exe: stk500_recv(): programmer is not respondingavrdude.exe: stk500_initialize(): failedavrdude.exe: initialization failed, rc=-1Double check connections and try again, or use -F to overridethis check.avrdude.exe: Send: Q  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe done. Thank you.Sniffed communication.Code:[15/07/2021 09:20:59] - Open port COM4 (C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude.exe)[15/07/2021 09:20:59] Written data (COM4)30 20[15/07/2021 09:20:59] Read data (COM4)14 10[15/07/2021 09:21:00] Written data (COM4)30 20[15/07/2021 09:21:00] Read data (COM4)14 10[15/07/2021 09:21:00] Written data (COM4)30 20[15/07/2021 09:21:00] Read data (COM4)14 10[15/07/2021 09:21:00] Written data (COM4)41 80 20[15/07/2021 09:21:10] Written data (COM4)41 81 20[15/07/2021 09:21:10] Read data (COM4)14 08 10[15/07/2021 09:21:10] Written data (COM4)41 82 20[15/07/2021 09:21:20] Written data (COM4)41 98 20[15/07/2021 09:21:20] Read data (COM4)14 03 10[15/07/2021 09:21:21] Written data (COM4)41 84 20[15/07/2021 09:21:21] Read data (COM4)14 03 10[15/07/2021 09:21:21] Written data (COM4)41 85 20[15/07/2021 09:21:31] Written data (COM4)41 86 20[15/07/2021 09:21:31] Read data (COM4)14 03 10[15/07/2021 09:21:31] Written data (COM4)41 87 20[15/07/2021 09:21:31] Read data (COM4)14 03 10[15/07/2021 09:21:31] Written data (COM4)41 89 20[15/07/2021 09:21:41] Written data (COM4)41 81 20[15/07/2021 09:21:41] Read data (COM4)14 08 10[15/07/2021 09:21:41] Written data (COM4)41 82 20[15/07/2021 09:21:51] Written data (COM4)42 86 00 00 01 01 01 01 03 ff ff ff ff 00 80 0400 00 00 80 00 20[15/07/2021 09:21:51] Read data (COM4)14 10[15/07/2021 09:21:51] Written data (COM4)45 05 04 d7 c2 00 20[15/07/2021 09:22:01] Written data (COM4)51 20[15/07/2021 09:22:01] Read data (COM4)14 10[15/07/2021 09:22:01] - Close port COM4When flashing with STK500v1 commandCode:/AVR_DUDE/avrdude.exe -C /AVR_DUDE/avrdude.conf -U flash:w:TEST_328p.hex -vvvv -p atmega328p -c stk500v1 -P COM4 -b 115200AVR-DUDE output:Code:avrdude.exe: Version 6.3-20190619Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/Copyright (c) 2007-2014 Joerg WunschSystem wide configuration file is "/AVR_DUDE/avrdude.conf"Using Port : COM4Using Programmer : stk500v1Overriding Baud Rate : 115200avrdude.exe: Send: 0  avrdude.exe: Send: 0  avrdude.exe: Send: 0  avrdude.exe: Recv: . avrdude.exe: Recv: . AVR Part : ATmega328PChip Erase delay : 9000 usPAGEL : PD7BS2 : PC2RESET disposition : dedicatedRETRY pulse : SCKserial program mode : yesparallel program mode : yesTimeout : 200StabDelay : 100CmdexeDelay : 25SyncLoops : 32ByteDelay : 0PollIndex : 3PollValue : 0x53Memory Detail :Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xffBlock Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xffBlock Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00Programmer Type : STK500Description : Atmel STK500 Version 1.x firmwareavrdude.exe: Send: A  .  avrdude.exe: ser_recv(): programmer is not respondingavrdude.exe: stk500_recv(): programmer is not respondingavrdude.exe: Send: A  .  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Send: A  .  avrdude.exe: ser_recv(): programmer is not respondingavrdude.exe: stk500_recv(): programmer is not respondingavrdude.exe: Send: A  .  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Recv: . Hardware Version: 4744608Firmware Version: 8.4611299avrdude.exe: Send: A  .  avrdude.exe: ser_recv(): programmer is not respondingavrdude.exe: stk500_recv(): programmer is not respondingavrdude.exe: Send: A  .  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Send: A  .  avrdude.exe: ser_recv(): programmer is not respondingavrdude.exe: stk500_recv(): programmer is not respondingavrdude.exe: Send: A  .  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Send: A  .  avrdude.exe: ser_recv(): programmer is not respondingavrdude.exe: stk500_recv(): programmer is not respondingVtarget : 420030.5 VVaref : 0.3 VOscillator : 921.600 kHzSCK period : 44930321.2 usavrdude.exe: Send: A  .  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Send: A  .  avrdude.exe: ser_recv(): programmer is not respondingavrdude.exe: stk500_recv(): programmer is not respondingavrdude.exe: Send: B  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe: Send: E  .  .  .  .  .  avrdude.exe: ser_recv(): programmer is not respondingavrdude.exe: stk500_recv(): programmer is not respondingavrdude.exe: stk500_initialize(): failedavrdude.exe: initialization failed, rc=-1Double check connections and try again, or use -F to overridethis check.avrdude.exe: Send: Q  avrdude.exe: Recv: . avrdude.exe: Recv: . avrdude.exe done. Thank you.Sniffed communication.Code:[15/07/2021 14:05:10] - Open port COM4 (C:\AVR_DUDE\avrdude.exe)[15/07/2021 14:05:10] Written data (COM4)30 20[15/07/2021 14:05:10] Read data (COM4)14 10[15/07/2021 14:05:11] Written data (COM4)30 20[15/07/2021 14:05:11] Read data (COM4)14 10[15/07/2021 14:05:11] Written data (COM4)30 20[15/07/2021 14:05:11] Read data (COM4)14 10[15/07/2021 14:05:11] Written data (COM4)41 80 20[15/07/2021 14:05:21] Written data (COM4)41 81 20[15/07/2021 14:05:21] Read data (COM4)14 08 10[15/07/2021 14:05:21] Written data (COM4)41 82 20[15/07/2021 14:05:31] Written data (COM4)41 98 20[15/07/2021 14:05:31] Read data (COM4)14 03 10[15/07/2021 14:05:31] Written data (COM4)41 84 20[15/07/2021 14:05:41] Written data (COM4)41 85 20[15/07/2021 14:05:41] Read data (COM4)14 03 10[15/07/2021 14:05:41] Written data (COM4)41 86 20[15/07/2021 14:05:51] Written data (COM4)41 87 20[15/07/2021 14:05:51] Read data (COM4)14 03 10[15/07/2021 14:05:51] Written data (COM4)41 89 20[15/07/2021 14:06:01] Written data (COM4)41 81 20[15/07/2021 14:06:01] Read data (COM4)14 08 10[15/07/2021 14:06:01] Written data (COM4)41 82 20[15/07/2021 14:06:11] Written data (COM4)42 86 00 00 01 01 01 01 03 ff ff ff ff 00 80 0400 00 00 80 00 20[15/07/2021 14:06:11] Read data (COM4)14 10[15/07/2021 14:06:11] Written data (COM4)45 05 04 d7 c2 00 20[15/07/2021 14:06:21] Written data (COM4)51 20[15/07/2021 14:06:21] Read data (COM4)14 10[15/07/2021 14:06:21] - Close port COM4