Sorry my english.
USBDevice::readEP (and _NB) calls USBHAL::endpointReadResult from USBHAL_STM32F4.cpp, which code is looks pretty strange:
P_STATUS USBHAL::endpointReadResult(uint8_t endpoint, uint8_t * buffer, uint32_t *bytesRead) {
if (!(epComplete & (1 << endpoint))) {
return EP_PENDING;
}
uint32_t* buffer32 = (uint32_t *) buffer;
uint32_t length = rxFifoCount;
for (uint32_t i = 0; i < length; i += 4) {
buffer32[i >> 2] = OTG_FS->FIFO[endpoint >> 1][0];
}
rxFifoCount = 0;
- bytesRead = length;
return EP_COMPLETED;
}
rxFifoCount is always 0, so, reading does not work.
This function uses binary operations, which i dont understand.
Is there any solution to fix it?
Sorry and thanks.
Sorry my english.
USBDevice::readEP (and _NB) calls USBHAL::endpointReadResult from USBHAL_STM32F4.cpp, which code is looks pretty strange:
P_STATUS USBHAL::endpointReadResult(uint8_t endpoint, uint8_t * buffer, uint32_t *bytesRead) { if (!(epComplete & (1 << endpoint))) { return EP_PENDING; }
uint32_t* buffer32 = (uint32_t *) buffer;
uint32_t length = rxFifoCount;
for (uint32_t i = 0; i < length; i += 4) { buffer32[i >> 2] = OTG_FS->FIFO[endpoint >> 1][0]; } rxFifoCount = 0;
rxFifoCount is always 0, so, reading does not work.
This function uses binary operations, which i dont understand. Is there any solution to fix it?
Sorry and thanks.