Skip to main content
Visitor II
September 8, 2008
Question

STR735 External interrupt is not occured sometimes

  • September 8, 2008
  • 2 replies
  • 839 views
Posted on September 08, 2008 at 08:29

STR735 External interrupt is not occured sometimes

    This topic has been closed for replies.

    2 replies

    yskimAuthor
    Visitor II
    July 22, 2008
    Posted on July 22, 2008 at 08:58

    Hi

    Generally, External interrupt is enabled in application board, but it has problem about it is not occured sometimes.

    I tested follows, using STR730-EVAL board.

    1. STR730-EVAL board configuration as follows

    Shorted between PWM0 pin and INT10 pin.

    Shorted between PWM1 pin and INT11 pin.

    Shorted between PWM2 pin and INT12 pin.

    Shorted between PWM3 pin and INT13 pin.

    2. Software

    PWM0~5 configurations

    #define PWM0_PERIOD 1000

    #define PWM0_INT_PRIORITY 1

    void Api_PWM0_Init(void)

    {

    PWM_InitTypeDef stPWM_Init;

    PWM_StructInit(&stPWM_Init);

    stPWM_Init.PWM_Prescaler0 = 0;

    stPWM_Init.PWM_Prescaler1 = 31; /* MCLOCK is 32Mhz */

    stPWM_Init.PWM_DutyCycle = PWM0_PERIOD/2; stPWM_Init.PWM_Period = PWM0_PERIOD;

    stPWM_Init.PWM_Polarity_Level = PWM_POLARITY_Low; PWM_Init(PWM0, &stPWM_Init); /* Initialize PWM */

    PWM_ITConfig (PWM0, ENABLE);

    EIC_IRQChannelConfig(PWM0_IRQChannel, ENABLE);

    EIC_IRQChannelPriorityConfig(PWM0_IRQChannel, PWM0_INT_PRIORITY);

    PWM_Cmd(PWM0, ENABLE); /* Enable a PWM */

    }

    each IRQ handler ( PWM0 ~ 3 )

    void PWM0_IRQHandler (void)

    {

    if(PWM_FlagStatus (PWM0) == SET)

    {

    PWM_FlagClear (PWM0);

    PWM0_it_counter++;

    }

    }

    External interrupt configuraton

    #define EXTIT10_PRIO 15

    void ExternalINT_config(void)

    {

    EIC_ExternalITTriggerConfig(EXTERNAL_IT10, EXTIT_TRIGGER_Rising);

    EIC_ExternalITTriggerConfig(EXTERNAL_IT11, EXTIT_TRIGGER_Rising);

    EIC_ExternalITTriggerConfig(EXTERNAL_IT12, EXTIT_TRIGGER_Rising);

    EIC_ExternalITTriggerConfig(EXTERNAL_IT13, EXTIT_TRIGGER_Rising);

    EIC_IRQChannelPriorityConfig(EXTIT10_IRQChannel, EXTIT10_PRIO);

    EIC_IRQChannelPriorityConfig(EXTIT11_IRQChannel, EXTIT11_PRIO);

    EIC_IRQChannelPriorityConfig(EXTIT12_IRQChannel, EXTIT12_PRIO);

    EIC_IRQChannelPriorityConfig(EXTIT13_IRQChannel, EXTIT13_PRIO);

    EIC_IRQChannelConfig(EXTIT10_IRQChannel, ENABLE);

    EIC_IRQChannelConfig(EXTIT11_IRQChannel, ENABLE);

    EIC_IRQChannelConfig(EXTIT12_IRQChannel, ENABLE);

    EIC_IRQChannelConfig(EXTIT13_IRQChannel, ENABLE);

    }

    each external interrupt IRQ handler ( INT10~13 )

    void EXTIT10_IRQHandler (void)

    {

    INT10_it_counter++;

    GPIO_BitSet(GPIO4, 4); // LD6 ON

    if(PWM0_it_counter > INT10_it_counter)

    {

    if((PWM0_it_counter - INT10_it_counter) > 1) GPIO_BitSet(GPIO4, 0);

    else GPIO_BitReset(GPIO4, 0);

    }

    else

    {

    if((INT10_it_counter - PWM0_it_counter) > 1) GPIO_BitSet(GPIO4, 0);

    else GPIO_BitReset(GPIO4, 0);

    }

    GPIO_BitReset(GPIO4, 4); // LD6 Off

    }

    UART0 Configration

    Baud rate 115200, 8 data bit , 1 stop bit

    UART Message in Windows Hyper terminal

    -------------------------------

    -- External interrupt Test --

    -------------------------------

    PWM_0:000007D0 IT_10:000007CC

    PWM_1:000007D0 IT_11:000007CE

    PWM_2:0000029C IT_12:0000029B

    PWM_3:000001F5 IT_13:000001F4

    PWM_4:00007D10

    PWM_5:00007D10

    00000001

    -------------------------------

    PWM_0:00000FA0 IT_10:00000F9B <- there is different value

    PWM_1:00000FA0 IT_11:00000F9B

    PWM_2:00000537 IT_12:00000535

    PWM_3:000003E9 IT_13:000003E8

    PWM_4:0000FA20

    PWM_5:0000FA20

    00000002

    -------------------------------

    Attached files are my test code and waveform capture.

    Could anybody please check it?

    Thank you.

    ________________

    Attachments :

    External_interrupt_test.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtQy&d=%2Fa%2F0X0000000aPx%2FcRCM8MTWnkyw2kgBFVYNKByhbw3Wp3zM4E2d.5IodTk&asPdf=false

    print_000.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HtLM&d=%2Fa%2F0X0000000aLj%2FAkb0WHvgAYzAjz7zZ_wRVHu_I7UJffQjgTj1gLpZP2c&asPdf=false
    Visitor II
    September 8, 2008
    Posted on September 08, 2008 at 08:29

    Hi !

    I have the same problem but with different microcontroller configuration. I am using the fast interrupts for timer 0 and the external interrupt and sometimes the fast isr is not executed even though there is a puls on the microcontroller port pin. I set a port pin of the microcontroller from low to high and back always when the isr for external pulse is executed. The same thing I do with the timer 0 isr part. On the oscilloscope I can see that the fast isr for the external pulse is NOT executed when the timer 0 was 5µs before.

    It seems to me that the required register is not correctly updated and as result the fast isr for the external pulse is sometimes not executed.

    I hope ST can help in that case.