couldn't get g4 usb clock and pin setup just yet. Leave it as it is for now
This commit is contained in:
@@ -31,6 +31,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// G474RE Nucleo does not has usb connection. We need to manually connect
|
||||
// - PA11 for D+, CN10.14
|
||||
// - PA12 for D-, CN10.12
|
||||
|
||||
// LED
|
||||
#define LED_PORT GPIOA
|
||||
#define LED_PIN GPIO_PIN_5
|
||||
@@ -49,6 +53,7 @@
|
||||
#define UART_TX_PIN GPIO_PIN_2
|
||||
#define UART_RX_PIN GPIO_PIN_3
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// RCC Clock
|
||||
//--------------------------------------------------------------------+
|
||||
@@ -81,6 +86,36 @@ static inline void board_clock_init(void)
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
|
||||
|
||||
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_8);
|
||||
|
||||
#if 0 // TODO need to check if USB clock is enabled
|
||||
/* Enable HSI48 */
|
||||
memset(&RCC_OscInitStruct, 0, sizeof(RCC_OscInitStruct));
|
||||
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48;
|
||||
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
|
||||
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
|
||||
/*Enable CRS Clock*/
|
||||
RCC_CRSInitTypeDef RCC_CRSInitStruct= {0};
|
||||
__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);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void board_vbus_sense_init(void)
|
||||
|
||||
Reference in New Issue
Block a user