2013-01-09 04:01 AM
I am trying to falsh a example program through a STM32 discovery debugger/programmer on an external STM32 chip. all the connections are right and done according to the instructions written in the Datasheet of STM discovery. Even Build was executed without any error .I have n clue now why i cannot see the LED blinking on PORTA.3 and PORTB.0. The code i have used is as shown below':-
#include ''stm32f10x_conf.h''/* led connected to a gpio pin */#define LED1_PIN GPIO_Pin_0#define LED1_PORT GPIOB#define LED3_PIN GPIO_Pin_3#define LED3_PORT GPIOA/* user functions */void delay(unsigned long count); int main(){ GPIO_InitTypeDef GPIO_InitStructure; /* Enable GPIOx Clock */ RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); /* Setup SysTick Timer for 0.1 msec interrupts */ if (SysTick_Config(SystemCoreClock / 10000)) // old 1000 { /* Capture error */ while (1); } /* enable clock on GPIOB peripheral */ //RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOA, ENABLE); /* set pin output mode */ GPIO_InitStructure.GPIO_Pin = LED1_PIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(LED1_PORT, &GPIO_InitStructure); //LED 2 //LED 3 GPIO_InitStructure.GPIO_Pin = LED3_PIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(LED3_PORT, &GPIO_InitStructure); //LED 4 while(1) { GPIO_SetBits(LED1_PORT, LED1_PIN); // set pin high delay(2000000); GPIO_ResetBits(LED1_PORT, LED1_PIN); // set pin low delay(2000000); GPIO_SetBits(LED3_PORT, LED3_PIN); // set pin high delay(2000000); GPIO_ResetBits(LED3_PORT, LED3_PIN); // set pin low delay(2000000); } //return 0;}void delay(unsigned long count){ while(count--);}2013-01-09 04:26 AM
Which IDE you are using? Are you able to download program correctly into MCU?
2013-01-09 04:31 AM
I am Using IAR embedded Workbench C platform.. Ya downloading shows no error.
2013-01-09 04:39 AM
I am sorry i but i did not check properly .. the downloading is not occurring.
2013-01-09 08:27 AM
You might want to check your project settings - under Debugger, in the Setup tab, make sure the driver is set to your particular JTAG/debugger link type, and not to Simulator.
That one had me confused for a bit.