Solved
STM32CubeMX F3 USB bug
When I have enabled USB Device for stm32f3discovery, the usbd_conf.c had this lines (59..63):
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
static void PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
else
void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state);
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */Notice the "else" without hash (#) symbol.
