[STM32L4] Hard fault during OSC32_OUT init as GPO
I want to use the OSC32_OUT Pin (PC15) of the STM32L432KC as general purpose output. Moreover i connected a FET with a pullup to this pin and want to control them. I do not use any LSE oscillator functionality. The datasheet states that upon reset this pin already can be used as GPIO if not configured as LSE and or controlled by the Backup domain.
If i use the generated CUBE IDE init code, i always face a Hard Fault in the HAL_GPIO_Init routine.
The fault anaylzer shows the follwing messages:
- Bus, memory management or usage fault (FORCED)
- Attempt to execute undefined instruction (UNDEFINSTR)
- SP: 0x2000FEC8
- LR: 0x40010400
- PC: 0xA0000000 (this seems to be wrong)
- R0: 0x48000800 (GPIOC)
Attached the init code:
#define STANDBY_Pin GPIO_PIN_15
#define STANDBY_GPIO_Port GPIOC
void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(STANDBY_GPIO_Port, STANDBY_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin : STANDBY_Pin (PC15) */
GPIO_InitStruct.Pin = STANDBY_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(STANDBY_GPIO_Port, &GPIO_InitStruct);
}If i step through the HAL_GPIO_Init function i do not got any hard faults.
Did i miss something?
