Skip to content

Commit 0ffbf3e

Browse files
committed
fix(clock): handle HSE TCXO when available
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 0c69f37 commit 0ffbf3e

File tree

1 file changed

+7
-2
lines changed
  • libraries/SrcWrapper/src/stm32

1 file changed

+7
-2
lines changed

Diff for: libraries/SrcWrapper/src/stm32/clock.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,15 @@ void enableClock(sourceClock_t source)
129129
}
130130
break;
131131
case HSE_CLOCK:
132-
__HAL_RCC_HSE_CONFIG(RCC_HSE_ON);
132+
#if defined(RCC_HSE_BYPASS_PWR) && defined(LORAWAN_BOARD_HAS_TCXO) && (LORAWAN_BOARD_HAS_TCXO == 1)
133+
uint32_t HSEState = RCC_HSE_BYPASS_PWR;
134+
#else
135+
uint32_t HSEState = RCC_HSE_ON;
136+
#endif
137+
__HAL_RCC_HSE_CONFIG(HSEState);
133138
if (__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET) {
134139
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
135-
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
140+
RCC_OscInitStruct.HSEState = HSEState;
136141
}
137142
break;
138143
default:

0 commit comments

Comments
 (0)