cancel
Showing results for 
Search instead for 
Did you mean: 

CDC_Transmit_FS fails

Posted on January 28, 2018 at 23:07

Hi,

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.

1 REPLY 1
Posted on January 29, 2018 at 21:19

I replaced the TeraTerm terminal emulator with latest 4.97 version which does not introduce the 100msec delay and everything works fine.

I was not able to investigate STM32 side.