Initialisation fails when using CubeMX and HSE clock source
Hi,
I am using Windows 10 Pro with SMT32CubeMX (V4.20) and firmware STM32Cube FW_F4 V1.15.0 imported into System Workbench for STM32 (V1.13.1).
I am using an Olimex P405 (STM32F405RGT6 device) development board and ST-LINK/V2 JTAG debugger.
When I configure the CubeMX project to use HSI clock everything works as expected. However, I would like to use HSE as the clock source which is connected to an 8MHz crystal. In this case the function HAL_RCC_OscConfig() returns the error HAL_ERROR.
On further inverstigation into the execution of HAL_RCC_OscConfig(), I find the following.
The first part of the function that configures the HSE clock succeeds and the external crystal oscillator starts up and can be seen on an oscilloscope.
The next part of the function that configures the HSI clock fails at the following line of code.
if((__HAL_RCC_GET_FLAG(RCC_FLAG_HSIRDY) != RESET) && (RCC_OscInitStruct->HSIState != RCC_HSI_ON))
{
return HAL_ERROR;
}
Any help why this is happening would be appreciated.
Regards
FarmerJo