AnsweredAssumed Answered

[SOLVED] Can't make HSE oscillator to work (STM32F103C8T6)

Question asked by AndyOlivares on Oct 28, 2014
Latest reply on Jan 6, 2015 by AndyOlivares

I'm writing in desperation because I've been trying to make an HSE oscillator to work with absolutly no luck.

I little bit of context: a couple of months ago, I wanted to play with an STM32F103C8T6 microcontroller for a project I'm trying to do. At first I designed a simple LQFP48 to DIP48 PCB board to mount the uC to a breadboard. Soldered the chip to the DIP shaped PCB and mounted it to the breadboard. I made a simple LDO power supply circuit (3.3V) in the breadboard, put some 100nF capacitors at VDDs/VSSs pins (of my DIP PCB leads), tied BOOT0 and BOOT1 to ground, put a 8 MHz crystal with a couple of 22pF capacitors to ground (all in the breadboard) and it all worked like a charm. I could program the uC with my STLinkV2 with no problems. Just to emphasize, the only thing soldered to this PCB was the uC, everything else was implemented in the breadboard.

Then I decided to move forward and make a new PCB that includes all common components like power connections and capacitors, cystal oscillator circuit, some headers for common peripherals (like USART1, SPI1, etc.) and BOOT0/1, following the same tiny DIP PCB shape which would be easily mountable into my breadboard.
When the newly designed PCB arrived, I soldered all components, applied power to it and voilá! The crystal does not start at all!
I used the same crystal as my previous tests and the same capacitor values (this time in SMD 1206 packages).

My first guess was that the crystal was defective so I replaced it with a brand new one but the same thing happened. It does not oscillate; but I can connect to the uC through SWD, program the flash memory and I can even load a program (blinky test) but of course it doesn't work at the expected frequency.

I've tried everything and nothing works. I've been through Application Note "AN2867 - Oscillator design guide for STM8S, STM8A and STM32 microcontrollers" a couple of times. I did all the calculations and it seems to me that my oscillator circuit should work (the crystal I'm using is in case anyone would like to make the calculations).

I even connected an oscilloscope to one of the crystal leads in my first circuit (the one in the breadboard) and I can see a beatufil 8 MHz sinusoidal signal. The same is not true for the crystal circuit mounted in my second PCB.
I don't know what else to try or what else to do. Maybe just give up and try to make a new PCB.

I attached my schematics and also an image of the routing in my PCB around the crystal oscillator (note that because of size constraints I placed oscillator capacitors in the bottom layer of the PCB).

Please take a look at these files and tell me if you have any advice or if you spot any error or potencial problem. I don't know what else to try. I know I might not have followed all crystal layout recommendations in AN2867 as I didn't know about them at the time I designed the PCB, but I feel the oscillator should work anyway. Please let me know if you think it should not. I'm sure the schematics could contain some errors as this is my first PCB with an STM32 uC so bare with me :)

Thank you so much for your help and time in advance.

Best regards,