5 Replies Latest reply on Aug 21, 2019 2:16 AM by lech_4350316

    Problem with INT16 on MB9BF218S (LQFP-144)

    lech_4350316

      Hello,

       

      I'm using a MB9BF218S (LQFP-144) microcontroller.

      I have a 50 Hz square wave signal connected to P57 (pin 20 = P57/SOT1_0/TIOB09_2/INT16_1/MNCLE_0) that I want to use to trigger an interrupt on the rising edge.

      I configured it as follows :

      PFR5 bit 7 = 0          (I also tried =1, same problem)

      PCR5 bit 7 = 0

      DDR5 bit 7 = 0

      ELVR1.LA16=0, ELVR1.LB16=1 = rising edge mode

       

      I'm 100% sure that P57 toggles every 10 ms (I read P57 GPIO pin every millisecond).

      However, My ISR is running once only, immediately after setting ENIR bit 16 to 1.

      In the ISR, I'm clearing EIRR bit 16, but it never gets set afterwards.

       

      Is there anything else I have to do ?

      Is there anything special with this INT16_1 pin on MB9BF218S  LQFP-144 ?

      Please find below the code snippets relative to this interrupt configuration.

       

      Thanks and Best Regards,

      Christian.

       

       

      initialization code :

        FM3_EXTI->ENIR_f.EN16 = 0;                // Disable External Interrupt INT16 before configuring it

        FM3_EXTI->ELVR1_f.LA16 = 0;

        FM3_EXTI->ELVR1_f.LB16 = 1;               // ELVR1.LA16 & LB16 = '01' = detect a rising edge

        NVIC_ClearPendingIRQ(EXINT8_31_IRQn);     // Reset pending External Interrupt Request ch.8 to ch.31

        NVIC_EnableIRQ(EXINT8_31_IRQn);           // Enable External Interrupt Request ch.8 to ch.31

        NVIC_SetPriority(EXINT8_31_IRQn, L3_IRQ_LEVEL_BT);       // Set interrupt priority

        FM3_EXTI->ENIR_f.EN16 = 1;                // Enable External Interrupt INT16

       

      INT16 ISR :

      void INT8_31_Handler ( void )

      {

          volatile uint8_t dummy;

       

          if ( FM3_EXTI->EIRR_f.ER16 )

          {

              // Reset External Interrupt 16 flag

              dummy = FM3_EXTI->EIRR_f.ER16;

              FM3_EXTI->EICL_f.ECL16 = 0;

              dummy = FM3_EXTI->EIRR_f.ER16;

          }

      }