cancel
Showing results for 
Search instead for 
Did you mean: 

BUG: Code generation for "HSE" is incorrectly configured as "HSI".

GGilb.1
Associate II

STM32CubeIDE v1.4.2

STM32F4 v1.25.2

STM32F446RC

I generated my code and got this:

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;

The HSE crystal is never turned on anywhere. Big bug.

I change this to:

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
//RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;

And now my USB finally works. =)

HSE is configured in RCC as "Crystal/Ceramic Resonator". I have not added anything to the code. I can send you files if that would help.

1 ACCEPTED SOLUTION

Accepted Solutions
GGilb.1
Associate II

Ok I found the problem. Inside my clock configuration "HSI" was selected and not "HSE". Not sure why STM32CubeIde wouldn't give a warning because the USB simply doesn't work with HSI selected.0693W000005AlUNQA0.png

View solution in original post

2 REPLIES 2
GGilb.1
Associate II

I added the .ioc file. Should be now easy to reproduce this by simply running the code generation. The one GPIO PC3 I am using to light up an LED when the Error_Handler() is executed. Otherwise this is just USB CDC (Full Speed Device) + RCC HSE which is not generated correctly so I was seeing my LED light up and thought the crystal was working but no then I learned the STM32F4 has an internal one that was used instead which explained why the USB was not working :)

GGilb.1
Associate II

Ok I found the problem. Inside my clock configuration "HSI" was selected and not "HSE". Not sure why STM32CubeIde wouldn't give a warning because the USB simply doesn't work with HSI selected.0693W000005AlUNQA0.png