hi
I have a STM32F103RB based board that im trying to write code for to test the board. Previously i have only used 8 bit micros (8051 and pic's) so this is a step up. I have tried using the exam code found in this thread (http://www.keil.com/forum/17340/) however im still failing to get an LED to turn on.
here is my code:
#include "stm32f10x_lib.h" #include "STM32_Init.h" //#include "STM32F10x.s" #include <stm32f10x_gpio.h> //#include <stm32f10x_cl.h> //#define LED_On(led) GPIOA->ODR |= (led <<1) //#define LED_0ff(led) GPIOA->ODR &= ~(led <<1) int main(void) { int i; RCC->APB2ENR |= 0x0008; GPIOB->CRL = 0x00000003; for(;;){ for(i=0; i<0x40000; i++){} GPIOB->ODR = 0x0000aaaa; for(i=0; i<0x40000; i++){} GPIOB->ODR = 0x00005555; } }
i believe i have setup the jtag programmer correctly (segger unit). the build window looks like this after loading into the micro
Build target 'Target 1' assembling STM32F10x.s... compiling STM32_Init.c... compiling main.c... linking... Program Size: Code=396 RO-data=252 RW-data=0 ZI-data=608 ".\Bin\STM32F103B_ATTEMPT_3.axf" - 0 Error(s), 0 Warning(s). Load "D:\\Program Files\\Keil\\ARM\\Jase Play\\LED_Blink\\Bin\\STM32F103B_ATTEMPT_3.AXF" Set JLink Project File to "D:\Program Files\Keil\ARM\Jase Play\LED_Blink\JLinkSettings.ini" JLink info: ------------ DLL: V4.20p, compiled Nov 19 2010 15:55:07 Firmware: J-Link ARM V8 compiled Jan 31 2011 18:34:52 Hardware: V8.00 S/N : 268000424 OEM : SEGGER-EDU Feature(s) : FlashBP, GDB * JLink Info: TotalIRLen = 9, IRPrint = 0x0011 * JLink Info: Found Cortex-M3 r1p1, Little endian. * JLink Info: TPIU fitted. * JLink Info: FPUnit: 6 code (BP) slots and 2 literal slots ROMTableAddr = 0xE00FF003 Target info: ------------ Device: STM32F103RB VTarget = 3.390V State of Pins: TCK: 1, TDI: 0, TDO: 0, TMS: 0, TRES: 1, TRST: 1 Hardware-Breakpoints: 6 Software-Breakpoints: 2048 Watchpoints: 0 JTAG speed: 2000 kHz Erase Done. Programming Done. Verify OK.
cheers for any help