Closed Maldus512 closed 2 years ago
Hi,
This seems like to be the same issue as #48. Are you by any chance using a CP2102N UART adapter, at high speeds?
A pull request would be appreciated, yes. A 'flush_input' method on SerialConnection sounds perfect.
This is now implemented in c018d70e3498ce4196cd73e592e2a894c00abdb2 .
I am trying to flash firmware onto an STM32F413 powered custom board through the UART1 bootloader. It appears that on system reset via the DTR line my MCU fires off a null (0x00) byte that prevents any bootloading tool I've tried so far (
stm32loader
, st-flash, STMCubeProgrammer) from succeeding.With your Python module I could slightly bend the procedure and find out the issue. A temporary solution was to flush the input FIFO of the serial port right after resetting the MCU:
Would it be worth to integrate this behavior with a pull request? I realize this might as well be an issue with my custom hardware, but it shouldn't do any harm to throw away any received character before the bootloader synchronization has even begun. I can also see that this fix breaks the abstraction of the SerialConnection object; should I add another method to "flush" incoming input?