cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32WB55] [BLE_DataThroughput + CDC_Standalone] [USB not working]

theARTof1337
Associate II

Hello, dear STM32 developers!
I'm trying to modify BLE_DataThroughput application adding USB logs feature. I'm adding USB initialization code from CDC_Standalone example project, but windows does not recognize the device. I've added initialization function 

/* Initialize all configured peripherals */

MX_GPIO_Init();

MX_DMA_Init();

MX_RF_Init();

MX_RTC_Init();

MX_RNG_Init();

/* USER CODE BEGIN 2 */

MX_USB_Device_Init();

 

/* USER CODE END 2 */

 

/* Init code for STM32_WPAN */

MX_APPE_Init();

 

I modified clock configuration function to block HSEM 5, but USB still isn't working

void USBD_Clock_Config(void)

{

RCC_OscInitTypeDef RCC_OscInitStruct = {0};

RCC_CRSInitTypeDef RCC_CRSInitStruct= {0};

 

LL_HSEM_1StepLock( HSEM, 5 );

/* Enable HSI48 */

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48;

RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;

RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;

if (HAL_RCC_OscConfig(&RCC_OscInitStruct)!= HAL_OK)

{

Error_Handler();

}

/*Configure the clock recovery system (CRS)**********************************/

 

/*Enable CRS Clock*/

__HAL_RCC_CRS_CLK_ENABLE();

 

/* Default Synchro Signal division factor (not divided) */

RCC_CRSInitStruct.Prescaler = RCC_CRS_SYNC_DIV1;

 

/* Set the SYNCSRC[1:0] bits according to CRS_Source value */

RCC_CRSInitStruct.Source = RCC_CRS_SYNC_SOURCE_USB;

 

/* HSI48 is synchronized with USB SOF at 1KHz rate */

RCC_CRSInitStruct.ReloadValue = __HAL_RCC_CRS_RELOADVALUE_CALCULATE(48000000, 1000);

RCC_CRSInitStruct.ErrorLimitValue = RCC_CRS_ERRORLIMIT_DEFAULT;

 

/* Set the TRIM[5:0] to the default value */

RCC_CRSInitStruct.HSI48CalibrationValue = RCC_CRS_HSI48CALIBRATION_DEFAULT;

 

/* Start automatic synchronization */

HAL_RCCEx_CRSConfig (&RCC_CRSInitStruct);

}

 

Please, help. i suggest, that my next steps should be registering some tasks in the sequencer and setting tasks to send data into USB, when i need to make logs. But now i cannot successfully initialize USB, so i can't move on....

 

1 REPLY 1
FBL
ST Employee

Hi @theARTof1337 

Did you test the example provided CDC Standalone

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.