USB HOST CDC USBH_CDC_Receive frequent interrupts problem
Hi!
I'm using stm32f105vct6, project generated with CubeMx, Usb Host CDC with FreeRTOS (cmsis v2)
usb_cdc.c
USBH_FindInterface(phost, COMMUNICATION_INTERFACE_CLASS_CODE, ABSTRACT_CONTROL_MODEL, COMMON_AT_COMMAND);
was changed to
USBH_FindInterface(phost, COMMUNICATION_INTERFACE_CLASS_CODE, ABSTRACT_CONTROL_MODEL, NO_CLASS_SPECIFIC_PROTOCOL_CODE);
otherwise there was no enumeration
#define CDC_RX_BUFFER_SIZE 512
uint8_t CDC_RxBuffer[CDC_RX_BUFFER_SIZE];
After Appli_state == APPLICATION_READY I set
memset(CDC_RxBuffer, 0, CDC_RX_BUFFER_SIZE);
USBH_CDC_Receive(&hUsbHostFS, CDC_RxBuffer, CDC_RX_BUFFER_SIZE);
and USBH_CDC_ReceiveCallback:
// Handles the data recived from the USB CDC host
rx_size = USBH_CDC_GetLastReceivedDataSize(phost);
for (int i = 0; i < rx_size; i++)
{
pp_circle_buf[pp_iend++] = CDC_RxBuffer[i];
if(pp_iend >= PP_CIRCLE_BUF_SIZE) pp_iend = 0;
}
USBH_CDC_Receive(phost, CDC_RxBuffer, CDC_RX_BUFFER_SIZE);
osSemaphoreRelease(semUSBDataReadyHandle);
Transmission and reception (including packets of several kilobytes) work fine.
But there is a problem. When not issuing USBH_CDC_Receive interrupts are with period ~1ms.
But if prepare receiving buffer with USBH_CDC_Receive interrupts become more frequent, so many tasks in FreeRTOS got freezed (including watchdog task). System almost hang up except USB (all communication with paypass device works fine, USB task has normal priority)
Executing USBH_CDC_Stop(&hUsbHostFS); returns to normal interrupt rate (with no receiving)
PayPass device may transfer at any time, so I need to wait packets all the time while processing transaction
May be I do something wrong in receiving?
Thanks for help
