I successfully developed USB bootloader loader for STM32F103C8 MCU. It works as follow:
teraterm (an old terminal) script reads hex file line by line and sends these lines through USB VCP port (each line is acknowledged by the STM32F103C8 - typical send / wait operation so the teraterm can send next line only after receiving ack from the STM32 side)
Since the teramterm introduces 100ms gap in-between subsequent send operations I decided to write simple PC application using gcc to speed up the bootloader operations (avoid this teraterm gap).
The app is based on Windows WriteFile / ReadFile function used for serial communication. Also the approach is the same: send /wait.
Unfortunately when I upload the hex file through this new app I do not get the ack from the STM32F103C8.
What I did so far:
-I compared the USB frames in both cases (teraterm and app) using USB sniffer - the hex line from the PC is the same in both cases; there is no ack frame when app is used - so the problems seems to be related to STM32
-I debugged bootloader activities from the STM32 side and see that the CDC_Transmit_FS is called and does not return error - probably I will need to deeply analyse nested calls inside CDC_Transmit_FS because quick debugging did not show any difference between app and teraterm case; of course I added other flags in the code to be sure that the code runs correctly
-I introduced a delay before calling the CDC_Transmit_FS (after receiving hex line) - no help
I believe there is something in the timing at the USB level (which makes STM32 unhappy) but I cannot prove it.
I you could suggest further step - how to investigate this problem.