cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 oscillator not starting

browndav
Associate II
Posted on April 28, 2016 at 07:44

I'm using the STM32F105R8 on a custom 4 layer board.  Boot0 is pulled to ground via a 10k resistor.  Boot1 is floating.

The board is based on some open hardware with associated open source software.  I'm using the same crystal and caps as the reference hardware does.

I'm able to program it using segger J-Flash lite (see image attached below).

But, it doesn't appear that the code is actually running.  When I probe the oscillator pins, I see something, but it's basically noise.  Not a nice wave like I was expecting.  So I'm thinking this is why the code isn't running. 

This is the crystal I'm using:

https://www.digikey.com/product-search/en?keywords=644-1052-1-ND

And this is the 8pf capacitor I'm using:

https://www.digikey.com/product-search/en?keywords=445-5042-1-ND

The schematic and layout are attached below.

Does anybody know why it's not starting?
2 REPLIES 2
Posted on April 28, 2016 at 13:59

And have you stepped though, or done any debugging, on your code?

Does it start the oscillator? The part runs initially off it's internal 8 MHz HSI, so should be quite capable of outputting to LEDs or USARTs without the external clock starting.

What's NRESET doing? Can you do basic signs-of-life tests via USART1 and the System Loader?

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
browndav
Associate II
Posted on April 28, 2016 at 21:27

Well huh. I got these tools installed in Windows, and I can step through and blink my leds.

http://gnuarmeclipse.github.io/ It sure looks like it's initializing and using the external oscillator.

HSEStatus 

= 1 so drops out of this loop before hitting the timeout.

static void SetSysClockTo72(void)
{
__IO uint32_t StartUpCounter = 0, HSEStatus = 0;
/* SYSCLK, HCLK, PCLK2 and PCLK1 configuration ---------------------------*/ 
/* Enable HSE */ 
RCC->CR |= ((uint32_t)RCC_CR_HSEON);
/* Wait till HSE is ready and if Time out is reached exit */
do
{
HSEStatus = RCC->CR & RCC_CR_HSERDY;
StartUpCounter++; 
} while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
etc...

Now I'm trying to do the same thing in Ubuntu, and not having any luck (all of the open source stuff is linux based, and won't build in Windows). Now I just need to figure out why it can't find cc1. Edit: blinky isn't building (can't find cc1), so now I'm assuming there's something weird with my build tools, so the open source stuff isn't compiling right. But it is compiling without errors though...