Gün Geçmiyorki Yeni Bir Hatayla Karşılaşmayayım.

Başlatan muhittin_kaplan, 16 Temmuz 2015, 01:27:22

muhittin_kaplan

STM32f100 ve em::blocks ile timer kesmesi yapıyorum. Yok Yapamıyorum, Kodlar Tamam sıkıntı olmaması lazım. Ama Bir türlü INT Girmiyor.
/*
**
**                           Main.c
**
**
**********************************************************************/
/*
   Last committed:     $Revision: 00 $
   Last changed by:    $Author: $
   Last changed date:  $Date:  $
   ID:                 $Id:  $

**********************************************************************/

#include "stm32f10x_conf.h"


void TIM2_IRQHandler(void){
  TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
  if(GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_9)){
    GPIO_WriteBit(GPIOC, GPIO_Pin_9, RESET);//ÇAlışmaya Devam Ediyor
  }else{
    GPIO_WriteBit(GPIOC, GPIO_Pin_9, SET);
  }
}

int main(void)
{
  GPIO_InitTypeDef GPIO_InitStructure;
  TIM_TimeBaseInitTypeDef TIM_TimeBase_InitStructure;
  NVIC_InitTypeDef NVIC_InitStructure;

  SystemInit();

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9|GPIO_Pin_8;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIOC, &GPIO_InitStructure);


  NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
  NVIC_Init(&NVIC_InitStructure);

    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
  TIM_TimeBase_InitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
  TIM_TimeBase_InitStructure.TIM_CounterMode = TIM_CounterMode_Up;
  TIM_TimeBase_InitStructure.TIM_Period = 1000-1;
  TIM_TimeBase_InitStructure.TIM_Prescaler = 24000-1;
  TIM_TimeBaseInit(TIM2, &TIM_TimeBase_InitStructure);

  TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);

  TIM_Cmd(TIM2, ENABLE);

  while(1){
      GPIO_SetBits(GPIOC,GPIO_Pin_8);//Sistem Çalıştı
  }
}


peki problem ne neden çalışmıyor,

problemin çözümü

Alıntı Yap
heck the Linker - edit settings and check whether the interrupt vector address is mapped to 0x08003000..

If the address is 0x08000000 then the interrupt will not work.

That would be a hugely asinine thing for IAR to do. By default if the FLASH is booting the vector table should appear at zero and 0x08000000

Check the value of __vector_table in the .MAP file

One could presumably configure it in the NVIC directly so there's no chance the compiler can screw it up.

extern void * __vector_table;
NVIC_SetVectorTable((u32)(&__vector_table), 0x0);


Either way, the code is viable in Keil, so check your environment.

I'd also suggest, that instead of pasting my code into a broken project, you get the VL Discovery firmware, build a couple of those in IAR, prove they appear to be working. Then paste in my main() and interrupt code into those.

I'm not convinced you RCC_init() code is viable, certainly in the VL Discovery project the system clocks are already set up via the CMSIS library and the defines the compiler uses to build the project.

Oddly the web address silk screened on the board ISN'T VIABLE

Instead use :
http://www.st.com/internet/evalboard/product/250863.jsp
http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/stm32vldiscovery_package.zip

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy%2est%2ecom%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fSTM32f100%20how%20start%20TIM1%20interrupt%20handler&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=10551

Mucit23