Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

STM32: can use built-in bootloader to upload my code, but nothing happens

Status
Not open for further replies.

allanvv

Advanced Member level 4
Full Member level 1
Joined
Oct 23, 2010
Messages
108
Helped
14
Reputation
28
Reaction score
12
Trophy points
1,298
Location
USA
Visit site
Activity points
2,078
I made a board with an STM32F103C8T6. I can successfully use the UART to program and verify the on-board flash memory with the built-in bootloader. But then when I reset and I boot into flash, nothing works.

My code just turns on/off a GPIO that I'm monitoring with a scope. I've verified that the external clock is operating properly (8MHz).

It seems by default that it uses the internal oscillator, so I tried to set it to use the external oscillator by uncommenting "#define SYSCLK_FREQ_HSE HSE_Value" but still nothing happens on reset.

Here's my code:

Code:
int main(void) {
	SystemInit();

	GPIO_InitTypeDef GPIO_InitStructure;
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
	GPIO_Init(GPIOA, &GPIO_InitStructure);

	GPIO_WriteBit(GPIOA, GPIO_Pin_15, 1);

	while (1) {
		GPIO_WriteBit(GPIOA, GPIO_Pin_15, 1);
		GPIO_WriteBit(GPIOA, GPIO_Pin_15, 0);

	}
}

edit: This is with an arm gcc 4.5.2. I've used this toolchain successfully on an STR7 board in the past. I've also tried with CodeSourcery's toolchain but still no results.
 
Last edited:

Turns out the issue was in the linker script and startup assembly code. I tried the ones used in these projects: **broken link removed**

and it worked perfectly.
 


One thing -- why do you state that the clock speed when running from the internal oscillator is limited to 36MHz? You can set the multiplier to 16x, and then it'll run at 64MHz. I couldn't find anything in the datasheet that has a different max frequency for internal vs external oscillator. Also in the supply current page, one of the tests they do is for 64MHz internal oscillator.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top