# How to solve interrupt conflicts?

**URL:** https://forums.sifive.com/t/how-to-solve-interrupt-conflicts/3030
**Category:** HiFive1 Rev B
**Created:** [November 13, 2019, 10:45am UTC](https://forums.sifive.com/t/how-to-solve-interrupt-conflicts/3030 "2019-11-13T10:45:14Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@daniel](https://forums.sifive.com/u/daniel)
#### Post date: [November 13, 2019, 10:45am UTC](https://forums.sifive.com/t/how-to-solve-interrupt-conflicts/3030/1 "2019-11-13T10:45:14Z")

</div>

Hi,  
I am decoding the ppm signal as channel by channel(from the RC receiver) in my interrupt handler. The output results like jittery.

> - CH1 - CH2 - CH3- CH4 - CH5 - CH6
> - 1481 - 1529 - 1500 - 1519 - 1010 - 1014
> - 1479 - 1488 - 1557 - 1472 - 1007 - 1062
> - 1493 - 1502 - 1514 - 1539 - 976 - 1026
> - 1479 - 1517 - 1542 - 1471 - 1016 - 1038
> - 1512 - 1476 - 1533 - 1496 - 999 - 1035
> - 1479 - 1525 - 1534 - 1475 - 1033 - 1006
> - 1495 - 1480 - 1543 - 1508 - 984 - 1038
> - 1495 - 1522 - 1499 - 1513 - 1009 - 1019
> - 1489 - 1480 - 1557 - 1472 - 1006 - 1057
> - 1500 - 1510 - 1499 - 1543 - 972 - 1027
> - 1478 - 1505 - 1546 - 1479 - 1013 - 1038
> - 1512 - 1477 - 1523 - 1526 - 976 - 1035
> - 1479 - 1516 - 1529 - 1488 - 1027 - 1020
> - 1508 - 1473 - 1562 - 1481 - 992 - 1038
> - 1488 - 1522 - 1499 - 1518 - 1010 - 1013
> - 1485 - 1488 - 1551 - 1478 - 1006 - 1062
> - 1508 - 1502 - 1498 - 1522 - 986 - 1035
> - 1479 - 1510 - 1535 - 1485 - 1012 - 1050
> - 1516 - 1472 - 1528 - 1522 - 985 - 1034

the first four channels were supposed to be at 1500(+/- 2)  
but it is unstable.

i will post my ISR() as well.

```
    void ISR(){

  //METHOD 3
//noInterrupts();
//clear_csr(mstatus, MSTATUS_MIE);

  unsigned long now = micros();
 
  // a long gap means we start again
  if ((now - lastPulse) >= 2000)
    count = 0;
  lastPulse = now;
  if (count >= (SIGNAL_COUNT +1))
    return;
    
  
  widths [count++] = now;

   if(channel_Num < count ){
   
    // Serial.print (" Ch ");
    // Serial.print (channel_Num);
       // Serial.print (" - ");
    // Serial.print (widths [channel_Num] - widths [channel_Num - 1]);
       receiver_input[channel_Num]=widths [channel_Num] - widths [channel_Num - 1];
      
      Serial.print(" - ");Serial.print(receiver_input[channel_Num]);
       channel_Num++;
  }
 if (count >= SIGNAL_COUNT)
    {
    count = 0;
    channel_Num=1;
   
    Serial.println();
        
    }
  

GPIO_REG(GPIO_RISE_IP) = ppmPinMsk;
//set_csr(mstatus, MSTATUS_MIE);
//interrupts();
  // Clear out the interrupt pending bit, or the interrupt will 
  // just happen again as soon as we return,
  // and we'll never get back into our loop() function. 
  // These are write-one-to-clear.  
 
} 

```

But when i test it as a stand alone code ,it is perfect!  
The problem comes when i use the code in my flight controller main code.(NO issues with the other sensor’s communication)

I will post the link of my full code  
[https://github.com/danielkc26/dani\_codes/blob/master/RC\_Drone\_hifive1\_MPU9265\_0.1\_TEST.ino](https://github.com/danielkc26/dani_codes/blob/master/RC_Drone_hifive1_MPU9265_0.1_TEST.ino)
