2015-01-15 07:32 AM
2015-01-16 06:01 AM
2015-01-19 01:56 AM
2015-04-03 05:10 AM
I tested this problem on
STM32Cube_FW_F4_V1.5.0. The problem is still there.
To reproduce the bug, it's just enough to modify theHAL_TIM_PeriodElapsedCallback
function as followed:void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{ uint32_t buffptr; uint32_t buffsize;/*******************************************************************************/
/* Added : Testing code added to show the bug */ { static unsigned int cpt = 0; // Wait for end of enumeration if (cpt >= 200) { UserTxBufPtrOut = APP_RX_DATA_SIZE - 32; memcpy(&UserTxBuffer[UserTxBufPtrOut], &cpt, 4); } cpt++; } /*******************************************************************************/ if(UserTxBufPtrOut != UserTxBufPtrIn) { if(UserTxBufPtrOut > UserTxBufPtrIn) /* Rollback */ { buffsize = APP_RX_DATA_SIZE - UserTxBufPtrOut; } else { buffsize = UserTxBufPtrIn - UserTxBufPtrOut; } buffptr = UserTxBufPtrOut; USBD_CDC_SetTxBuffer(&USBD_Device, (uint8_t*)&UserTxBuffer[buffptr], buffsize); if(USBD_CDC_TransmitPacket(&USBD_Device) == USBD_OK) { UserTxBufPtrOut += buffsize; if (UserTxBufPtrOut == APP_RX_DATA_SIZE) { UserTxBufPtrOut = 0; } } } } If somebody can help, it would be great