STMicroelectronics / STM32CubeL0

STM32Cube MCU Full Package for the STM32L0 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
Other
105 stars 56 forks source link

usbd_cdc_if.c lacking function definition for CDC_TransmitCplt_FS #34

Open kaptptrx opened 7 months ago

kaptptrx commented 7 months ago

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.

ALABSTM commented 7 months ago

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,

kaptptrx commented 7 months ago

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.