Problem while using several external interrupts (simultaneously), Arduino DUE

Hi everybody,
I have faced a very wierd problem. What I am trying to do is to read 5 PWMs using external interrupts of a DUE. Here is my code:

int ch1 = 13;
int ch2 = 12;
int ch3 = 11;
int ch4 = 10;
int ch5 = 9;
volatile int x = 0;
volatile unsigned long chvalue[] = {0, 0, 0, 0, 0};
volatile unsigned long pin[]={13, 12, 11, 10, 9};
volatile unsigned long t1;
void setup() {
  
  pinMode(13, INPUT_PULLUP);
  pinMode(12, INPUT_PULLUP);
  pinMode(11, INPUT_PULLUP);
  pinMode(10, INPUT_PULLUP);
  pinMode(9, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(pin[x]), rising, RISING);
  Serial.begin(9600);
  delay(100);
}

void loop() {

}
void rising() {
  t1 = micros();
  attachInterrupt(digitalPinToInterrupt(pin[x]), falling, FALLING);
}
void falling() {
  chvalue[x] = micros() - t1;
  Serial.print(chvalue[0]);
  Serial.print("  ");
  Serial.print(chvalue[1]);
  Serial.println("  ");
  detachInterrupt(digitalPinToInterrupt(pin[x]));
  x = x + 1;
  if (x == 4)
  {
    x = 0;
  }
  attachInterrupt(digitalPinToInterrupt(pin[x]), rising, RISING);
}

As you can see, interrupts are attached to pins one after another and not at the same time. By the way, the problem is that when I open serial monitor, I see some data that are absolutely wrong. Since they are PWM's high time, they should be between 1000 and 2000, but they fluctuate between 1000 and 19990! Moreover changing one PWM's duty cycle, will affect the others. I suppose it's a problem of interference among interrupts, but is it logical (since the code only use one interrupt at the time)?
By the way, I have checked the wiring, changed the pins (like thousands of time!) and used only two PWMs (to see if there is a problem, and it still was). Do any of you guys know how to overcome this issue?
Any help is grately appreciated!

My tendency, from looking at what you are trying to accomplish, would be to run your program under a RTOS such as uMT or freeRTOS.

Hi and thanks for your reply. Actually the problem was with the micros() function, itself. It was a bug. See this post to figure it out.