Skip to content

Slow Read in Reply Mode

Georg Icking-Konert edited this page Dec 12, 2020 · 2 revisions

The stm8gal verify step reads back the STM8 memory content and compares it with the PC memory image.

However, reading back memory via a 2-wire interface (i.e. Rx and Tx via separate lines) and in "UART reply mode" is extremely slow. This is caused by a few ms USB latency for each byte which has to echoed (individually) by the PC.

Measured times for write/read 32kB of data (2-wire, 115.2kBaud, different UART modes, PC under Linux 18.04):

  • CH340G USB<->TTL converter:
    • duplex mode: write 12.3s, read back 7.8s
    • reply mode: write 4.7s, read back 74.8s
  • FT232R USB<->TTL converter:
    • duplex mode: write 16.4s, read back 9.4s
    • reply mode: write 16.4s, read back 530s

Detailed timing depends on PC USB drivers, but a small USB latency seems unavoidable. For example measured CH340G latency is only 2.3ms, which adds up to >1min for reading 32kB. See issue 20

Reply mode is a property of the used STM8 device and UART (see UM0560), i.e. the ROM-BL behavior cannot be changed by stm8gal.

Proposals:

  • upload custom RAM routine to read back specified memory range without echo -> same as before, only without echo
  • upload custom RAM routine to calculate a checksum over a specified memory range and send to PC or store at fixed RAM address

Note: STM8L does not require custom RAM routines for write/erase. As some STM8L use "UART reply mode", do not replace (STM8S) erase() or write(), but load to address >=0x200 ("GO" command erases RAM content below 0x200)

Clone this wiki locally