I have successfully flashed an LED blinking application on TWR K60F120M board but when I run the application the execution is unstoppable its going to some unknown memory I have flashed my code into flash address 0x00000000
Below is I have copied my code
#include "twr-k60f120m.h"
#include "mcg.h"
#include "cw.h"
#include "MK60F12.h"
void wait (void);
const int led_user1 = ((unsigned int) 0x01 << 11);
const int led_user2 = ((unsigned int) 0x01 << 28);
const int led_user3 = ((unsigned int) 0x01 << 29);
const int led_user4 = ((unsigned int) 0x01 << 10);
#define GPIO_PIN(x) (((1)<<(x & GPIO_PIN_MASK)))
#define GPIO_PIN_MASK 0x1Fu
void wait (void)
{
int i;
for(i=0;i<500000;i++);
}
int main (void)
{
//Set PTA10, PTA11, PTA28, and PTA29 (connected to LED's) for GPIO functionality
PORTA_PCR10=(0|PORT_PCR_MUX(1));
PORTA_PCR11=(0|PORT_PCR_MUX(1));
PORTA_PCR28=(0|PORT_PCR_MUX(1));
PORTA_PCR29=(0|PORT_PCR_MUX(1));
//Change PTA10, PTA11, PTA28, PTA29 to outputs
GPIOA_PDDR=GPIO_PDDR_PDD(GPIO_PIN(10) | GPIO_PIN(11) | GPIO_PIN(28) | GPIO_PIN(29));
for(;;)
{
//Set PTA10 to 0 (turns on blue LED)
GPIOA_PDOR&=~GPIO_PDOR_PDO(GPIO_PIN(10));
wait();
//Toggle the green LED on PTA29
GPIOA_PTOR|=GPIO_PDOR_PDO(GPIO_PIN(29));
wait();
//Set PTA28 to 0 (turns on yellow LED)
GPIOA_PDOR&=~GPIO_PDOR_PDO(GPIO_PIN(28));
wait();
//Set PTA11 to 0 (turns on orange LED)
GPIOA_PDOR&=~GPIO_PIN(11);
wait();
/* GPIOA_PCOR = led_user1;
- wait();
- GPIOA_PCOR = led_user2;
- wait();
- GPIOA_PCOR = led_user3;
- wait();
- GPIOA_PCOR = led_user4;
- wait();
-
- GPIOA_PDDR = led_user4;
- wait();
- GPIOA_PDDR = led_user3;
- wait();
- GPIOA_PDDR = led_user2;
- wait();
- GPIOA_PDDR = led_user1;
- wait();*/
}
}