2015-03-27 04:07 AM
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
2015-03-27 08:39 AM
What version of STM32CubeF4
you are using
?Version
of STM32CubeF4changed
also ?