kanflo / opendps

Give your DPS5005 the upgrade it deserves
MIT License
895 stars 124 forks source link

Stabilise and improve UART protocol #198

Open kanflo opened 5 years ago

kanflo commented 5 years ago

There are a few design flaws in the current UART upgrade protocol and the use thereof, as mentioned in #191

  1. dpsctl.py does not do do retransmits
  2. As there are no counters in the CMD_UPGRADE_DATAframes, a resent frame might result in device 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:

  1. There should be protocol support to change the baud rate.
  2. Backwards compatibility should be kept (old/new dpsctlshould be able to upgrade new/old dpsboot for all permutations of 'old' and 'new').
kanflo commented 5 years ago

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.

hseibel12 commented 5 years ago

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.

Harvie commented 5 years ago

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)

4nthonylin commented 4 years ago

Any updates on this? I cannot upload firmware due to Error: device reported CRC error.