From 755387ee31d8638089dd2791de82e4737dc79333 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 26 Jan 2022 13:56:44 +0100 Subject: [PATCH] Reduce bInterval of interrupt endpoints to avoid interrupt misses Particularly the VCC/RST/CLK changes can happen quite frequent, and we were seeing quite a number of overflows of the usb_buf queue for EP06 (interrupt endpoint) in cardem. I first tried increasing the maximum queue size to up to 10, but that still didn't resolve those EP06 overflow error log messages. Reducing the bInterval from 16 to 1 made them go away in all my tests. Change-Id: I5c272c31983de7201cfbd445c4484f6832d878ab --- firmware/libcommon/source/usb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/firmware/libcommon/source/usb.c b/firmware/libcommon/source/usb.c index d86fc923..7a99b158 100644 --- a/firmware/libcommon/source/usb.c +++ b/firmware/libcommon/source/usb.c @@ -206,7 +206,7 @@ static const SIMTraceDriverConfigurationDescriptorSniffer SIMTRACE_USB_EP_CARD_INT), .bmAttributes = USBEndpointDescriptor_INTERRUPT, .wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS, - .bInterval = 0x10, + .bInterval = 1, }, DFURT_IF_DESCRIPTOR(1, 0), }; @@ -382,7 +382,7 @@ static const SIMTraceDriverConfigurationDescriptorPhone SIMTRACE_CARDEM_USB_EP_USIM1_INT), .bmAttributes = USBEndpointDescriptor_INTERRUPT, .wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS, - .bInterval = 0x10 + .bInterval = 1 }, #ifdef CARDEMU_SECOND_UART /* Communication class interface standard descriptor */ @@ -429,7 +429,7 @@ static const SIMTraceDriverConfigurationDescriptorPhone SIMTRACE_CARDEM_USB_EP_USIM2_INT), .bmAttributes = USBEndpointDescriptor_INTERRUPT, .wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS, - .bInterval = 0x10, + .bInterval = 1, }, DFURT_IF_DESCRIPTOR(2, 0), #else @@ -547,7 +547,7 @@ static const SIMTraceDriverConfigurationDescriptorMITM CCID_EPT_NOTIFICATION), .bmAttributes = USBEndpointDescriptor_INTERRUPT, .wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS, - .bInterval = 0x10, + .bInterval = 1, }, /* Communication class interface standard descriptor */ @@ -593,7 +593,7 @@ static const SIMTraceDriverConfigurationDescriptorMITM SIMTRACE_USB_EP_PHONE_INT), .bmAttributes = USBEndpointDescriptor_INTERRUPT, .wMaxPacketSize = USBEndpointDescriptor_MAXINTERRUPTSIZE_FS, - .bInterval = 0x10 + .bInterval = 1 }, DFURT_IF_DESCRIPTOR(2, 0), };