STM32F7 USB Host CDC data transmits result in NAK interrupt flood
I am trying to implement some very basic USB communication functionalities between my STM32F7 and another device. The device can usually be configured by ASCII messages through serial, and so I am trying to achieve that same functionality but through USB. As a starter I am trying to send a single command, and that is where my trouble starts.
I am using the STMCube USB Host libraries (v1.15.0 found at https://github.com/STMicroelectronics/STM32CubeF7/tree/master/Middlewares/ST/STM32_USB_Host_Library/Class/CDC). I am able to connect and enumerate successfully with the device, so basic levels of back-and-forth communication are there. The issue comes when I try to transmit my ASCII message to the device.
When I call the USBH_CDC_Transmit(found in usbh_cdc.c) function, the STM32F7 gets flooded with interrupts, specifically the NAK and channel-disabled interrupts in HCD_HC_OUT_IRQHandler(found in stm32f7xx_hal_hcd.c). This causes the CDC data transfer state machine to get stuck in a loop. The NAK causes the state machine to try resending the message, the message gets NAK'd immediately, and the process continues. This is all happening so quickly and so often that the performance of the system lags considerably with a USB interrupt triggering every 10 microseconds.
I have looked and have found similar cases to mine:
https://community.st.com/s/question/0D50X00009Xked0SAB/stm32cube-usb-host-driver-interrupt-flood
These other cases have offered insight, but the major difference being that they were dealing with an excess of interrupts during IN data transactions where I am just trying to get OUT data transactions to work.
Does anyone have any insight into this? I can definitely provide more information if needed.
Thank you in advance
