cancel
Showing results for 
Search instead for 
Did you mean: 

STR91x + Keil = living hell

istvan
Associate II
Posted on January 03, 2013 at 00:40

I use the Keil startup wizard to configure the processor initially, then I use the ST91x software library to configure the GPIO port 7, VIC and TIM3 to blink 0xAA on Port7 in the TIM3 ISR, but I'm stucked there forever (so is my program).

I bought the this Keil's MCBSTR9 to advance to ARM architecture over a year ago, and I'm an advanced TI MSP prorgrammer - this shouldn't be happening.... :( What am I missing here? I keep stucking in every interrupt....

---

&sharpinclude <91x_lib.h>

unsigned short int gout = 0xAA;

int main()

{

 &sharpifdef DEBUG

 debug();

 &sharpendif

 

 GPIO_InitTypeDef GPIO_InitStruct;

 TIM_InitTypeDef TIM_InitStructure;

 

 GPIO_DeInit(GPIO7);

  GPIO_InitStruct.GPIO_Direction = GPIO_PinOutput;

  GPIO_InitStruct.GPIO_Pin = GPIO_Pin_All;

  GPIO_InitStruct.GPIO_Type = GPIO_Type_PushPull ;

 GPIO_InitStruct.GPIO_Alternate = GPIO_OutputAlt1;

  GPIO_Init (GPIO7, &GPIO_InitStruct);

 

  TIM_DeInit(TIM3);  /* TIM1 Deinitialization */

  TIM_InitStructure.TIM_Mode = TIM_OCM_CHANNEL_2;                          

  TIM_InitStructure.TIM_OC2_Modes = TIM_TIMING;              

  TIM_InitStructure.TIM_Clock_Source = TIM_CLK_APB;        

  TIM_InitStructure.TIM_Clock_Edge = TIM_CLK_EDGE_FALLING; 

  TIM_InitStructure.TIM_Prescaler = 0xFF;                 

  TIM_InitStructure.TIM_Pulse_Length_1 = 0x100;         

 

 TIM_Init (TIM3, &TIM_InitStructure);

 TIM_ITConfig(TIM3, TIM_IT_OC2, ENABLE);

 TIM_CounterCmd(TIM3, TIM_CLEAR);

 TIM_CounterCmd(TIM3, TIM_START);

 VIC_ITCmd(TIM3_ITLine, ENABLE);

 VIC_Config(TIM3_ITLine, VIC_IRQ,7);

 while(1);

}

__irq void TIM3_IRQHandler(void)

{

  TIM_ClearFlag(TIM3, TIM_FLAG_OC1);

  TIM_CounterCmd(TIM3, TIM_CLEAR);

  TIM_CounterCmd(TIM3, TIM_STOP);

  gout ^=0xAA;

  GPIO_Write(GPIO7, gout);

 VIC0->VAR =0;

 VIC1->VAR =0;

}

 ---

  I even stopped the timer to se if it's causing the issue, but it's not...

#mcbstr9 #keil #str912
1 REPLY 1
istvan
Associate II
Posted on January 21, 2013 at 19:23

The problem was with the paths included in the compiler. By default the compiler seems to be taking some other code rather than my own (or the ones that I provide) startup and ISR handlers, so the interrupts aren't handled properly, and also if you use the configuration wizard provided by Keil, it comes to strange behavior. 

If anyone stumbles upon this issue, I made a paralell topic on the Keil forum, please take a look, there's a lot more details in there:

http://www.keil.com/forum/22057/#msg116209