cancel
Showing results for 
Search instead for 
Did you mean: 

STR750 Interrupt example

lineatessile
Associate II
Posted on July 10, 2008 at 08:31

STR750 Interrupt example

2 REPLIES 2
lineatessile
Associate II
Posted on July 09, 2008 at 14:03

Dear All,

I'm new stakeholder of ST devices.

I'm using an STR750 with its Evaluation Board and CrossWork.

I tried some Examples to use the LCD, UART, GPIO and

I didn't find big difficulties.

I'm now trying to use the examples related to TIM and Interrupt:

void main()

{

#ifdef DEBUG

debug();

#endif

/* MRCC Configuration */

MRCC_Configuration();

/* GPIO Configuration */

GPIO_Configuration();

/* EIC Configuration */

EIC_Configuration();

/* TIM Configuration in Output Compare Toggle Mode ----------*/

/* CK_TIM = 60 MHz, Prescaler = 0x0, TIM0_CLK = CK_TIM/(Prescaler + 1) = 60 MHz */

/* OC1 update rate = TIM0_CLK / TIM_Pulse1 = 60 MHz/ 15000 = 4000 Hz (250 us) */

/* OC2 update rate = TIM0_CLK / TIM_Pulse2 = 60 MHz/ 6000 = 10000 Hz (100 us) */

/* TIM0 Channel1 configuration */

TIM_InitStructure.TIM_Mode = TIM_Mode_OCToggle;

TIM_InitStructure.TIM_Prescaler = 0x0;

TIM_InitStructure.TIM_ClockSource = TIM_ClockSource_Internal;

TIM_InitStructure.TIM_CounterMode = TIM_CounterMode_Up;

TIM_InitStructure.TIM_Period = 0xFFFF;

TIM_InitStructure.TIM_Channel = TIM_Channel_1;

TIM_InitStructure.TIM_Pulse1 = OC1Value;

TIM_InitStructure.TIM_Polarity1 = TIM_Polarity1_Low;

TIM_Init(TIM0, &TIM_InitStructure);

/* TIM0 Channel2 configuration */

TIM_InitStructure.TIM_Channel = TIM_Channel_2;

TIM_InitStructure.TIM_Pulse2 = OC2Value;

TIM_Init(TIM0, &TIM_InitStructure);

/* Preload register on TIM0_OCR1 and TIM0_OCR2 disabled: TIM0_OCR1 and TIM0_OCR2

values are taken in account immediately */

TIM_PreloadConfig(TIM0, TIM_Channel_ALL, DISABLE);

/* Clear TIM0 flags */

TIM_ClearFlag(TIM0, TIM_FLAG_OC1 | TIM_FLAG_OC2| TIM_FLAG_Update);

/* Enable TIM0 Output Compare1&2 interrupt */

TIM_ITConfig(TIM0, TIM_IT_OC1 | TIM_IT_OC2, ENABLE);

/* Enable TIM0 counter */

TIM_Cmd(TIM0, ENABLE);

while(1);

}

The example compiles fine but I was not able to realize how to verify the Interrupt on these lines. I tried to use the function EIC_GetCurrentIRQChannel()

inside the loop:

while(1){

if (EIC_GetCurrentIRQChannel()==TIM0_OC2_IRQChannel) ...

}

But this cause an incorrect verify of the Software downloaded in the Chip;

is it correct to use the function EIC_GetCurrentIRQChannel() to verify the appear of the interrupt on a certain line, or I completly missunderstood the interrupt working way ??

Thanks a lot for any helps, regards LT

[ This message was edited by: lnt on 09-07-2008 17:34 ]

lineatessile
Associate II
Posted on July 10, 2008 at 08:31

I tried to find out the problem,

I realized that in mine str75x_startup.s

probably there is not a correct link to the irq_handler.

It is written only:

irq_handler:

b. //endless loop

Shall I add some System file?? or write something instead of this

b.

thank you in advance