Skip to content

Commit

Permalink
fix(clock): handle HSE TCXO when available
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
  • Loading branch information
fpistm committed Sep 7, 2023
1 parent 0c69f37 commit bb1cb7f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libraries/SrcWrapper/src/stm32/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,15 @@ void enableClock(sourceClock_t source)
}
break;
case HSE_CLOCK:
__HAL_RCC_HSE_CONFIG(RCC_HSE_ON);
#if defined(RCC_HSE_BYPASS_PWR) && defined(LORAWAN_BOARD_HAS_TCXO) && (LORAWAN_BOARD_HAS_TCXO == 1)
uint32_t HSEState = RCC_HSE_BYPASS_PWR;
#else
uint32_t HSEState = RCC_HSE_ON;
#endif
__HAL_RCC_HSE_CONFIG(HSEState);
if (__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET) {
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.HSEState = HSEState;
}
break;
default:
Expand Down

0 comments on commit bb1cb7f

Please sign in to comment.