Stabilise and improve UART protocol
kanflo opened this issue · comments
There are a few design flaws in the current UART upgrade protocol and the use thereof, as mentioned in #191
dpsctl.py
does not do do retransmits- As there are no counters in the
CMD_UPGRADE_DATA
frames, a resent frame might result indevice reported CRC error
at the end of the upgrade process.
As this leads to changing the boot loader, the following should be added while at it:
- There should be protocol support to change the baud rate.
- Backwards compatibility should be kept (old/new
dpsctl
should be able to upgrade new/old dpsboot for all permutations of 'old' and 'new').
I guess a new CMD_UPGRADE_DATA2
frame is needed with a counter and dpsctl
could start with this one and fall back to CMD_UPGRADE_DATA
. The silly thing is that the boot loader does not NAK frames with unknown commands meaning we will need to throw a handful of CMD_UPGRADE_DATA2
at the DPS before falling back the old protocol. Gah!
A boot loader upgrade method should be implemented too for the brave out there.
It is really a good idea to have some kind of handshake dialogue for the bootloader and to repeat a broken frame. I found (#191) that the device just breaks at some point in communication where the GUI is still running. But I am not quite sure if this is always the same behaviour. I will try to verify this tomorrow.
BTW has opendps ability to set device address in the serial protocol... I believe that original firmware allows to use multiple devices on single serial line (= they only TX when queried by specific address)
Any updates on this? I cannot upload firmware due to Error: device reported CRC error.