Pin change interrupt on pin8 broken?

Hello,

this code used to work fine on older IDEs (simple RC PWM pass through). pin 8 wasread for pwm and servo pwm out is on pin 9.
i recently upgraded to IDE 1.8.19 and it no longer runs or prints at all. it uploads fine to the board but nothing runs.
any idea why? the problem seems to be with attach interrupt as when i remove it the code runs and prints.


///////////////////////////////////////////////////////////////////////////////////////////////////////
/* PWM pass through controller

*/////////////////////////////////////////////////////////////////////////////////////////////////////

#include <Servo.h>
#include <PinChangeInt.h>
Servo gearservo;

// pins definition
#define rxPin 8
#define servoPin 9


long led_cycle;
int ledState = HIGH;// the current state of the output pin
int currentrc = 0;
volatile int pwm_value = 0;
volatile int prev_time = 0;
int count = 0;
int pwm_corrupted = 0;
int valid_pwm_flag = 0;
uint8_t latest_interrupted_pin;
uint32_t current_rc_counter = 0;
int filtered_rc = 1000;

void setup()
{
  pinMode(rxPin, INPUT);
  PCintPort::attachInterrupt(rxPin, &rising, RISING);
  pinMode(3, OUTPUT);
  digitalWrite(3, LOW);
  Serial.begin(115200);
  delay(100);
  gearservo.attach(servoPin);
}

void loop()
{

  gearservo.write (pwm_value);
  Serial.println(pwm_value);

} // END MAIN LOOP

void rising()
{
  PCintPort::attachInterrupt(rxPin, &falling, FALLING);
  prev_time = micros();
}

void falling()
{
  PCintPort::attachInterrupt(rxPin, &rising, RISING);
  pwm_value = micros() - prev_time;
}


which processor?

Which Arduino board are you using ?

Pro mini or Nano
just a reminder - this worked fine in the past on the same boards.

BOARD DIGITAL PINS USABLE FOR INTERRUPTS NOTES
Uno Rev3, Nano, Mini, other 328-based 2, 3
UNO R4 Minima, UNO R4 WiFi 2, 3

????

according to the doc here:

pro mini nano (328) can only attach interrupts on pins 2 and 3, but this worked for years before with pin 8.
besides, if Rxpin = 2, the same code which used to run fine, doesnt run at all.
im puzzled at this.

it doesnt even finish the setup. if i try to print in setup, it doesnt.

This code:

#include <Servo.h>
#include <PinChangeInt.h>
Servo gearservo;


// pins definition
#define rxPin 8
#define servoPin 9

int currentrc = 0;
volatile int pwm_value = 0;
volatile int prev_time = 0;

void setup()
{
  pinMode(rxPin, INPUT);
  //PCintPort::attachInterrupt(rxPin, &rising, RISING);
  Serial.begin(115200);
  delay(100);
  Serial.println("pwm pass through");
  delay(500);
  gearservo.attach(servoPin);
}

void loop()
{
  gearservo.write (pwm_value);
  Serial.println(pwm_value);

} // END MAIN LOOP

void rising()
{
  PCintPort::attachInterrupt(rxPin, &falling, FALLING);
  prev_time = micros();
}

void falling()
{
  PCintPort::attachInterrupt(rxPin, &rising, RISING);
  pwm_value = micros() - prev_time;
}

prints "pwm pass through" and then 0 0 0 0 0 0

This code (only uncomment pinchangeinterrupt line:

#include <Servo.h>
#include <PinChangeInt.h>
Servo gearservo;


// pins definition
#define rxPin 8
#define servoPin 9

int currentrc = 0;
volatile int pwm_value = 0;
volatile int prev_time = 0;

void setup()
{
  pinMode(rxPin, INPUT);
  PCintPort::attachInterrupt(rxPin, &rising, RISING);
  Serial.begin(115200);
  delay(100);
  Serial.println("pwm pass through");
  delay(500);
  gearservo.attach(servoPin);
}

void loop()
{
  gearservo.write (pwm_value);
  Serial.println(pwm_value);

} // END MAIN LOOP

void rising()
{
  PCintPort::attachInterrupt(rxPin, &falling, FALLING);
  prev_time = micros();
}

void falling()
{
  PCintPort::attachInterrupt(rxPin, &rising, RISING);
  pwm_value = micros() - prev_time;
}

does not print anything at all.
this is with nothing connected to the board (currently testing on Nano).

i tried 3 latest versions of Pinchangeint with no sucess:
1.2.9
1.2.8
1.2.7

it doesnt help im afraid.

this code does not print the initial print in setup:

#include <Servo.h>
#include <PinChangeInt.h>
Servo gearservo;


// pins definition
#define rxPin 8
#define servoPin 9

int currentrc = 0;
volatile int pwm_value = 0;
volatile int prev_time = 0;

void setup()
{
  pinMode(rxPin, INPUT);
  PCintPort::attachInterrupt(rxPin, rising, RISING);
  //attachPinChangeInterrupt(digitalPinToPinChangeInterrupt(rxPin), rising, RISING);
  //attachPinChangeInterrupt(rxPin, rising, RISING);
  Serial.begin(115200);
  delay(100);
  Serial.println("pwm pass through");
  delay(500);
  gearservo.attach(servoPin);
}

btw.. i tried running some pinchaneint examples. they all freeze as well, none of them print any values.

i commented those lines in the handlers. it never gets to them

which one?

tried the second one with good results! appreciate the help!

#include <Servo.h>
#include <YetAnotherPcInt.h>
Servo gearservo;


// pins definition
#define rxPin 8
#define servoPin 9

int currentrc = 0;
volatile int pwm_value = 0;
volatile int prev_time = 0;

void setup()
{
  pinMode(rxPin, INPUT);
  PcInt::attachInterrupt(rxPin, rising, RISING);
  Serial.begin(115200);
  delay(100);
  Serial.println("pwm pass through");
  delay(500);
  gearservo.attach(servoPin);
}

void loop()
{
  gearservo.write (pwm_value);
  Serial.println(pwm_value);

} // END MAIN LOOP

void rising()
{
  PcInt::attachInterrupt(rxPin, &falling, FALLING);
  prev_time = micros();
}

void falling()
{
  PcInt::attachInterrupt(rxPin, &rising, RISING);
  pwm_value = micros() - prev_time;
}

what happened to PCintport ?

thanks for your help