Hi everyone,
I’m newbie in ARM(have experience only with PICs). So I have
-
Windows XP Pro
-
Development board from Olimex STM32-H103(http://www.olimex.com/dev/stm32-h103.html)
-
Olimex ARM-Jtag (http://www.olimex.com/dev/arm-jtag.html)
-
IAR EW-ARM 5.2
What I want:
- Just turn on, turn off STAT Led on the board (connected to PC12)
Also I installed H-JTAG 0.9.1, download firmware from official ST web site and just modify template project.
main.c
#include "stm32f10x_lib.h"
/* Private variables ---------------------------------------------------------*/
GPIO_InitTypeDef GPIO_InitStructure;
ErrorStatus HSEStartUpStatus;
volatile unsigned long _1ms_counter;
/* Private function prototypes -----------------------------------------------*/
void RCC_Configuration(void);
void NVIC_Configuration(void);
void port_init(void);
void sys_tick_init(void);
void delay_ms(unsigned long delay);
int main(void){
RCC_Configuration(); // System Clocks Configuration
NVIC_Configuration();
port_init();
//sys_tick_init();
while(1){
GPIO_SetBits(GPIOC, GPIO_Pin_12);
delay_ms(500000);
GPIO_ResetBits(GPIOC, GPIO_Pin_12);
delay_ms(500000);
}
}
void RCC_Configuration(void)
{
/* RCC system reset(for debug purpose) */
RCC_DeInit();
/* Enable HSE */
RCC_HSEConfig(RCC_HSE_ON);
/* Wait till HSE is ready */
HSEStartUpStatus = RCC_WaitForHSEStartUp();
if(HSEStartUpStatus == SUCCESS)
{
/* Enable Prefetch Buffer */
FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
/* Flash 2 wait state */
FLASH_SetLatency(FLASH_Latency_2);
/* HCLK = SYSCLK */
RCC_HCLKConfig(RCC_SYSCLK_Div1);
/* PCLK2 = HCLK */
RCC_PCLK2Config(RCC_HCLK_Div1);
/* PCLK1 = HCLK/2 */
RCC_PCLK1Config(RCC_HCLK_Div2);
/* PLLCLK = 8MHz * 9 = 72 MHz */
RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
/* Enable PLL */
RCC_PLLCmd(ENABLE);
/* Wait till PLL is ready */
while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
{
}
/* Select PLL as system clock source */
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
/* Wait till PLL is used as system clock source */
while(RCC_GetSYSCLKSource() != 0x08)
{
}
}
}
void NVIC_Configuration(void){
NVIC_InitTypeDef NVIC_InitStructure;
#ifdef VECT_TAB_RAM
/* Set the Vector Table base location at 0x20000000 */
NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
#else /* VECT_TAB_FLASH */
/* Set the Vector Table base location at 0x08000000 */
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
#endif
}
//------------------------------------------------------------------------------
void port_init(void){
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOA, ENABLE);
// Configure PC.12 as output push-pull (LED)
GPIO_WriteBit(GPIOC,GPIO_Pin_12,Bit_SET);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
}
//------------------------------------------------------------------------------
void sys_tick_init(void){
SysTick_SetReload(9000);
SysTick_ITConfig(ENABLE);
SysTick_CounterCmd(SysTick_Counter_Enable);
}
//------------------------------------------------------------------------------
void delay_ms(unsigned long delay){
unsigned long temp = _1ms_counter;
while( _1ms_counter-temp < delay );
}
+STM firmware library
So, I compile & build project in IAR without errors, connect ARM-Jtag to PC, connect USB to dev board(for power supply), attach Jtag to dev board, startup H-Jtag server(target found Cortex M3), then press Ctrl-D in IAR (Download & Debug), press Go. And nothing…
Also I generate .Hex & program board via H-Flasher. Programing & verification without error, but Led on board doesn’t blink. :?:
Can anyone help me?
My project in IAR http://rapidshare.com/files/212671925/b … d.rar.html