cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube FW_F7 V1.12.0 CDC problem

Vthe
Associate II

After updating STM32Cube FW from F7 1.11.0 to 1.12.0 I encountered some problems with CDC FS on STM32F745VET. Short examples of simple code:

main.h

/* USER CODE BEGIN Private defines */
struct rxDataStruct
{
	unsigned char dataReceived;
	uint8_t data[25];
};
 
extern struct rxDataStruct rxData;
/* USER CODE END Private defines */

usbd_cdc_if.c

static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)
{
  /* USER CODE BEGIN 6 */
  USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
 
	for (unsigned int i = 0; i < *Len; i++)
	{
		rxData.data[i] = UserRxBufferFS[i];
	}
	rxData.dataReceived = 1;
 
  USBD_CDC_ReceivePacket(&hUsbDeviceFS);
  return (USBD_OK);
  /* USER CODE END 6 */
}

main.c

/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/
 
struct rxDataStruct rxData;
 
uint8_t REPLY_OK[4] = { 0xFF, 0x04, 0, 0 };
 
uint8_t captureCompleted = 0;
/* USER CODE END PV */
 
// ----------------------------------------------------- //
 
 /* USER CODE END 2 */
 
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
		if (rxData.dataReceived == 1)
		{
			captureCompleted = 1;
 
			sendReplyCDC(REPLY_OK, 4);
			rxData.dataReceived = 0;
		}
		
 
  /* USER CODE END WHILE */
 
  /* USER CODE BEGIN 3 */
 
  }
  /* USER CODE END 3 */
 
// --------------------------------------------- //
 
void sendReplyCDC(uint8_t *reply, uint8_t length)
{
	CDC_Transmit_FS(reply, length);
}

With instruction "captureCompleted = 1" in infinite loop, I never receive reply from STM32. If I remove this, I receive reply successfully. I have no this problem with STM32Cube FW_F7 V1.11.0

0 REPLIES 0