Skip to main content
Explorer
March 28, 2024
Solved

How to get callback 'CDC_TransmitCplt_FS(.......)' invoked

  • March 28, 2024
  • 2 replies
  • 2214 views

Hallo everyone,

Before I encountered a bug in an USB_OTG_FS library function (see previous post), I struggled to find out when the function  'CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)' has finished, meaning the content of the 'Buf' argument is completely transmitted.

After a thorough search through the various sources and the Reference manual RM068, I concluded the Register DOETMSK has a bit XFRCM that should fire an interrupt in case the the transmission has finished. I assume the common interrupt function ' HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS)' will deduce that function 'CDC_TransmitCplt_FS(.......)' should be fired when the XFRCM creates an interrupt.

Despite my efforts I could not find a way to:

   a) find out if my assumptions above are complete and/or correct

   b) how to handle the registers for the USB_OTG_FS device. In the SWF column of the debugger I saw 4 groups of OTG registers, but never found a way to access them in my code. And the complexity of this device, together with an overwhelming amount of typedefinitions, structures and enums makes it very difficult to deduce the rules for Register access.

Can someone shed some light on these issues? I will appreciate any help.

Thanks in advance,

Fred Schimmel

    This topic has been closed for replies.
    Best answer by FredS

    Hallo FBL,

    After some time reading in the UM1734, I gave up. Maybe because of my age, maybe due to the lack of background knowledge, I could not wrap my head around the descriptions. The USB design is so complex and so the software to handle all scenarios, I got lost many times.

    This conclusion, combined with not being able to connect to a PC, made me decide to return to an UART device for my project. I implemented it before, but then concluded the max. Baudrate of 115200 too low for my project. Now, after re-reading the RM0368 on UART baudrate, I will try to use this device with 7MB/s. I intend to report on my results.

    Greetings,

    Fred Schimmel

    2 replies

    Technical Moderator
    March 29, 2024

    Hello @FredS 

    Could you explain which bug? Is it about this thread ? Solved: Function body has content of opposite function - STMicroelectronics Community

    CDC_TransmitCplt_FS is used to inform that submitted data is successfully sent over USB. Check UM1734_STM32Cube.book to learn more about upper layer for software

    FredSAuthor
    Explorer
    March 29, 2024

    Hallo FBL,

    I can understand your confusion and yes, these two help requests are related as originally they are both encountered in the same project.

    The alleged cause of not be able to connect to a Windows COM port appeared to be a mistake on my side. The two functions look identical at first sight but are not, as Eddie pointed out before. However, the execution of the last statement in the function 'USB_DevConnect(......)' does appear to trigger the a failing attempt to create a VCP in Windows. This conclusion is the result of my last debugging of the test project I promised to report on. It shows my problem still exists and I realize in fact my question is now under the wrong subject.

    On the second sentence of your reply: I am busy reading the UM1734 and will react when I have questions.

    Thanks for your interest,

    Fred Schimmel

     

     

    FredSAuthorAnswer
    Explorer
    March 30, 2024

    Hallo FBL,

    After some time reading in the UM1734, I gave up. Maybe because of my age, maybe due to the lack of background knowledge, I could not wrap my head around the descriptions. The USB design is so complex and so the software to handle all scenarios, I got lost many times.

    This conclusion, combined with not being able to connect to a PC, made me decide to return to an UART device for my project. I implemented it before, but then concluded the max. Baudrate of 115200 too low for my project. Now, after re-reading the RM0368 on UART baudrate, I will try to use this device with 7MB/s. I intend to report on my results.

    Greetings,

    Fred Schimmel