cancel
Showing results for 
Search instead for 
Did you mean: 

Missing External Interrupts, frustration

benbb
Associate II
Posted on November 25, 2011 at 19:31

Any one with ideas on this one, I`ve never seen this on other micros:

STM32F103RE6

I have a simple application, an asyc pulse stream of data bits:

2.4mS and 1.2mS MAX 2.4mS = 1, 1.2mS = 0

Unfortunately the design does  not allow for CCP, So I have to sample on both edges an keep count....

 NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQChannel;

 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;

 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

 NVIC_Init(&NVIC_InitStructure);

I have tried all combinations of priorities etc...

I try to sample on BOTH edges and lo and behold the micro misses the edges, I have DISABLED ALL other interrupts, stopped all other processes and ONLY have the Interrupt running, I have a simple ''follow the leader'' pin that pulses high every time the interrupt happens and clears everytime the interrup exits.

void EXTI9_5_IRQHandler(void)

{

 EXTI->PR = EXTI_LINE_RFRX;

 BL_ON;       //make pin high here !! Reset the pin in MAIN while loop

 }

The ''follow the leader'' pin

 GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_8;        

 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;   

 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;            

 GPIO_Init( GPIOC, &GPIO_InitStructure );

The input pin where the INTERRUPTS are sampled

 GPIO_InitStructure.GPIO_Pin = GPIO_PIN_RFRX;

 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;

 GPIO_Init(GPIOC, &GPIO_InitStructure); 

    /* PCLK1 = HCLK/2 */

    RCC_PCLK1Config(RCC_HCLK_Div2);

This is running at 1/2 HCLK, but even when I set it to HCLK, NO DIFFERENCE edges are still missed.

I also tried the other route 1 edge at a time falling or rising samples are missed on a regular bases ?? it seems maninly the falling edges...
1 REPLY 1
infoinfo989
Associate III
Posted on November 26, 2011 at 22:04

The obvious concern here is that you're relying on main() to clear your pin - if a couple of interrupts come in quick succession then main() might not get a chance, making you believe you missed one of the interrupts (you'd probably think you missed the second one). First thing I would try is setting and clearing your pin in the IRQ handler. Something like this:

void EXTI9_5_IRQHandler(void)

{

 EXTI->PR = EXTI_LINE_RFRX;

 BL_ON;       //make pin high here !! Reset the pin in MAIN while loop

 BL_OFF;

 }

Then it becomes a simple matter to setup your scope to trigger off the interrupt source, with this pin as a second trace, and you'd be able to see if indeed you miss any.