2023-09-13 11:55 AM
Hello,
I have a problem with a clock configuration on my STM32F072C8T6. I need the 48MHz clock (HSI48) for the onboard USB communication. I have enabled this via ioc in the clock configuration. Everything looks fine there and no conflict is reported.
Now as soon as I load my program on the STM32, the debug connection breaks as soon as the following line is executed (in the automatically generated SystemClock_Config function --> see attachment) :
__HAL_RCC_HSI48_ENABLE(); (in the stm32f0xx_hal_rcc.c file)
I see that this line only writes the CR2 register with the following command:
RCC->CR2 |= RCC_CR2_HSI48ON;
Unfortunately I can't see which error handler the STM32 goes into, because the debug connection breaks. I have also tried to increase the FLASH latency with the following line, unfortunately without success:
FLASH->ACR |= 0x1;
If I run the program with the 8MHz everything works without problems.
Am I missing something? Can someone help me? Thanks a lot!
Solved! Go to Solution.
2023-09-20 06:15 AM
Is there a way in your circuit to measure current drawn from 3.3V? 150mA should be plenty. Could be other errors on the board or in the schematic that are causing the issue.
Is this a genuine chip?
Do you have an ST dev board or other known good hardware you could try this code on instead?
2023-09-20 08:48 AM
Yes I measured that this morning, it was about 16mA, so 150mA is actually more than enough.
This is always the point that you do not want to admit. :)
It could very well be a bug in the design, because I did my software development with the Nucleo-F072RB and everything worked there. Also, this is the first time I've worked with USB, so a mistake may have crept in.
Attached is my schematic for the microcontroller / USB. Hopefully the comments in German do not disturb. :D
2023-09-20 11:02 AM
All VDD/VSS pins need connected to 3V3/GND. Surprised it works at all.
BOOT0 should generally be pulled down and not left floating.
2023-09-20 11:13 AM
Thanks for the reply and the help, I didn't know that about BOOT0...I left that open on all previous designs.
The oversight with the VSS/VDD pins is however quite embarrassing to me. I'm also surprised that the part works without it at all. Will correct that tomorrow and put wire jumpers.
Sorry for the waste of time.
2023-09-20 11:51 AM
>>I didn't know that about BOOT0...I left that open on all previous designs.
That can result in indeterminate start-up, depending on how supply rises, and perceived floating voltage in can boot your code or the ROM's
The Analogue supplies are used for POR, PLL, crystals, etc not just ADC / DAC