Skip to content

Commit ac8c565

Browse files
committed
Add ARC_NO_RESUBMITREQUEST, if 0 will resbmit transfers on NAK
1 parent f6d051a commit ac8c565

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Diff for: src/USBHost/USBHostConf.h

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#define ARC_USB_FULL_SIZE (0)
2121
#define ARC_FS_OVER_HS (1)
22+
#define ARC_NO_RESUBMITREQUEST (0)
2223

2324
#include "mbed_config.h"
2425
#include "Callback.h"

Diff for: src/targets/TARGET_STM/USBHALHost_STM.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,20 @@ void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *pHcd, uint8_t uChann
133133
{
134134
if(!uEpIsInput)
135135
{
136+
#if ARC_NO_RESUBMITREQUEST
136137
// make sure that USB_OTG_HCCHAR_CHDIS and USB_OTG_HCCHAR_CHENA are reset to the correct values
137138
uint32_t tmpreg;
138139
tmpreg = USBx_HC(uChannel)->HCCHAR;
139140
tmpreg &= ~USB_OTG_HCCHAR_CHDIS;
140141
tmpreg |= USB_OTG_HCCHAR_CHENA;
141142
USBx_HC(uChannel)->HCCHAR = tmpreg;
143+
#else
144+
// Submit the same request again, because the device wasn't ready to accept the last one
145+
uint16_t uPacketSize = pHcd->hc[uChannel].max_packet;
146+
uint16_t uTransferSize = (pTransferDescriptor->size > uPacketSize) ? uPacketSize : pTransferDescriptor->size;
147+
HAL_HCD_HC_SubmitRequest(pHcd, uChannel, uEpIsInput, endpointType, !pTransferDescriptor->setup, (uint8_t *) pTransferDescriptor->currBufPtr, uTransferSize, 0);
148+
HAL_HCD_EnableInt(pHcd, uChannel);
149+
#endif
142150
}
143151
}
144152
break;

0 commit comments

Comments
 (0)