cancel
Showing results for 
Search instead for 
Did you mean: 

HSI48 on STM32F072C8T problem

Touby
Associate II

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!

14 REPLIES 14
TDK
Guru

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?

If you feel a post has answered your question, please click "Accept as Solution".
Touby
Associate II

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

TDK
Guru

All VDD/VSS pins need connected to 3V3/GND. Surprised it works at all.

TDK_0-1695232910257.png

BOOT0 should generally be pulled down and not left floating.

If you feel a post has answered your question, please click "Accept as Solution".
Touby
Associate II

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.

>>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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..