STM32CubeL0 icon indicating copy to clipboard operation
STM32CubeL0 copied to clipboard

usbd_cdc_if.c lacking function definition for CDC_TransmitCplt_FS

Open kaptptrx opened this issue 1 year ago • 2 comments

The file USB_DEVICE/App/usbd_cdc_if.c in the stm32L0 HAL, as generated by CubeMX doesn't contain support registering a callback for USB transmit complete, whereas this functionality does exist in stm32L4, among other HALs. Instead of registering a callback, we're forced to call a function in the application main loop.

This is the function that is defined in L4 but not L0.

static int8_t CDC_TransmitCplt_FS(uint8_t *pbuf, uint32_t *Len, uint8_t epnum);

It looks like the lower level USB HAL supports this callback, and the L0 reference manual indicates the transmit complete interrupt is supported by the hardware. Curious as to why it is not supported in the USB_DEVICE layer.

Our team has considered adding this functionality to the usbd_cdc_if.c file, but would prefer not to maintain code instead of just using autogenerated CubeMX code.

Is this a feature that you could add to the stm32CubeL0 HAL? Or if our team created a pull request adding this feature would you consider adding?

Thanks.

kaptptrx avatar Feb 14 '24 21:02 kaptptrx

Hi @kaptptrx,

I had a look into STM32CubeL4 firmware and could not find the CDC_TransmitCplt_FS() callback you mentioned. Rather, I found mention of a CDC_Itf_TransmitCplt() callback here for instance. I suppose they refer to the same thing.

Anyway, your question has been forwarded to our development teams. I will keep you updated.

With regards,

ALABSTM avatar Feb 19 '24 13:02 ALABSTM

Hi @ALABSTM

Thanks for your response.

It looks like the usbd_cdc_if.c file is generated using the usbd_cdc_if_template.c file? The L4 version of that file contains a definition for static int8_t TEMPLATE_TransmitCplt(uint8_t *pbuf, uint32_t *Len, uint8_t epnum); whereas the L0 version does not.

kaptptrx avatar Feb 20 '24 14:02 kaptptrx