2021-10-03 09:16 PM
Hi , I'm writing here to ask community some help with the F446VET chip. I tried the Cube Ide and CubeMX to perform all the settings.
What have been done so far :
After I flash the code generated on the board and connect through the USB connected to the pins A12 and A11 Windows is continuously trying to recognize the device , over and over again with the message "Device Description Failed " . Tried on other laptop and the same stuff.
Other suggestions and help would be appreciated, thank you.
Solved! Go to Solution.
2021-12-04 07:55 PM
Hi, to everyone who looked here I eventually found the solution.
In the usbd_cdc_if.c file had to add this code :
1
/* USER CODE BEGIN INCLUDE */
#define APP_RX_DATA_SIZE 2048// !!! aded by me
#define APP_TX_DATA_SIZE 2048
/* USER CODE END INCLUDE */
2
/* Private variables ---------------------------------------------------------*/
uint8_t buffer[7]; //!!!!!!Added by me
/* USER CODE END PV */
3
case CDC_SET_LINE_CODING:
buffer[0]=pbuf[0]; //////////Added by me
buffer[1]=pbuf[1];
buffer[2]=pbuf[2];
buffer[3]=pbuf[3];
buffer[4]=pbuf[4];
buffer[5]=pbuf[5];
buffer[6]=pbuf[6];
break;
case CDC_GET_LINE_CODING:
pbuf[0]=buffer[0];
pbuf[1]=buffer[1];
pbuf[2]=buffer[2];
pbuf[3]=buffer[3];
pbuf[4]=buffer[4];
pbuf[5]=buffer[5];
pbuf[6]=buffer[6];
static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
CDC_Transmit_FS(Buf, *Len); // ADED BY ME !!!!!!!!!!!!!
return (USBD_OK);
/* USER CODE END 6 */
}
and this solves the problem.
Moderator you can consider this problem closed.
2021-10-04 06:14 AM
In the F4 software package:
https://www.st.com/en/embedded-software/stm32cubef4.html
(CubeMX automatically donwload it on your PC, default dir is C:\Users\Login\STM32Cube\Repository)
There is an example:
STM32Cube_FW_F4_V1.26.2\Projects\STM32446E_EVAL\Applications\USB_Device\CDC_Standalone
Please compare the 2 projects to find what is missing.
2021-10-05 09:30 AM
Hi, thank you for your answer. I checked the files how you recommended and everything looks fine.
Today a connected the logical analyzer to the usb connector to see what signals I'm getting and this are the signals
the rest of them a repeating and they are similar to this one.
2021-12-04 07:55 PM
Hi, to everyone who looked here I eventually found the solution.
In the usbd_cdc_if.c file had to add this code :
1
/* USER CODE BEGIN INCLUDE */
#define APP_RX_DATA_SIZE 2048// !!! aded by me
#define APP_TX_DATA_SIZE 2048
/* USER CODE END INCLUDE */
2
/* Private variables ---------------------------------------------------------*/
uint8_t buffer[7]; //!!!!!!Added by me
/* USER CODE END PV */
3
case CDC_SET_LINE_CODING:
buffer[0]=pbuf[0]; //////////Added by me
buffer[1]=pbuf[1];
buffer[2]=pbuf[2];
buffer[3]=pbuf[3];
buffer[4]=pbuf[4];
buffer[5]=pbuf[5];
buffer[6]=pbuf[6];
break;
case CDC_GET_LINE_CODING:
pbuf[0]=buffer[0];
pbuf[1]=buffer[1];
pbuf[2]=buffer[2];
pbuf[3]=buffer[3];
pbuf[4]=buffer[4];
pbuf[5]=buffer[5];
pbuf[6]=buffer[6];
static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)
{
/* USER CODE BEGIN 6 */
USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
USBD_CDC_ReceivePacket(&hUsbDeviceFS);
CDC_Transmit_FS(Buf, *Len); // ADED BY ME !!!!!!!!!!!!!
return (USBD_OK);
/* USER CODE END 6 */
}
and this solves the problem.
Moderator you can consider this problem closed.