USB Device on STM32F405, lost bytes SOLVED!
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-03-27 4:07 AM
Posted on March 27, 2015 at 12:07
After updating to
version
4.7.0
, the error appearsno more.
I
'm backto version
4.6.0
and
the
error
will also
no longer occur.
Now I
'm not surewhat it was
.Maybe a
Windows
effect
(
Shut down the PCand start
again),
or the complete
re-
compilation of the project, or... I have a strange problem here. Data are transmitted over the function CDC_Transmit_FS.uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)
{
uint8_t result = USBD_OK;
/* USER CODE BEGIN 8 */
&sharpdefine USB_TRANSMIT_TIMEOUT 10000
uint32_t startTime = HAL_GetTick();
USBD_CDC_SetTxBuffer(hUsbDevice_0, Buf, Len);
do{
result = USBD_CDC_TransmitPacket(hUsbDevice_0);
}while((result == USBD_BUSY) && (SYS_DivTick(startTime) < USB_TRANSMIT_TIMEOUT));
switch(result){
case USBD_OK:
result = EC_NoError;
break;
case USBD_BUSY:
MX_USB_DEVICE_Init();
result = EC_Timeout;
break;
default:
result = EC_Communication;
break;
};
/* USER CODE END 8 */
return result;
} This also works well so far, as long as the data is less than 2 ^ 16. If the amount of data is greater than 2 ^ 16, then two blocks are sent in sequence.
error = CDC_Transmit_FS((uint8_t*)scopebuffer,50048);
if(error == EC_NoError) CDC_Transmit_FS((uint8_t*)scopebuffer+50048,50048);
If the first block length is not divisible by 128, then bytes will be lost. If the length is divisible by 128, then everything works fine. Has Anyone had similar experiences? Background Info: CubeMX in Version 4.6.0 SZM32F405 Own hardware and STMF4Discovery #stm32f4-cube-usb-device
Labels:
- Labels:
-
STM32Cube MCU Packages
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-03-27 8:39 AM
Posted on March 27, 2015 at 16:39
What version of STM32CubeF4
you are using
?Version
of STM32CubeF4changed
also ?
