Problem using interrupts and serial communication

Hey everyone!
I'm using an Arduino Uno to measure the frequency at which a pulse is generated. The pulse is generated by a hall effect switch which is connected to pin 2 as an interrupt, which initiates the ISR and calculates the frequency. In addition, the Arduino receives serial data which it uses to determine what piece of code to run.
The problem is that that every time I send serial data through the serial monitor, the Interrupt Service Routine is initiated even though no hall effect signal was generated. This screws up my measurements because the frequency is calculated in the ISR, so the false signal generates a false frequency. I also had difficulty reading the signal while using pin 3 as a PWM generate, which I fixed by using pin 5 instead.
I think it has something to do with pins 0 and 1 being Tx and Rx for serial communication (I'm connected via USB), and being on the same port an pin 2, but I'm not sure how to fix the problem.

String incomingByte; //Incoming serial byte
char firstChar; //First character of serial byte
//Volatile memory for changing in ISR
volatile long int currentTime, lastTime=micros();
volatile float delta, frequency;
volatile int count=0;
int debounceTime = 20000; //Debounce in micro-seconds

void setup() {
  Serial.begin(9600);
  pinMode(2,INPUT); //Initialize pin 
  attachInterrupt(digitalPinToInterrupt(2),hall_ISR,RISING); //Initialize ISR
  pinMode(LED_BUILTIN,OUTPUT);  //Debugging tool
}
void loop() {
  if (Serial.available() > 0) { //Wait for serial data
  incomingByte = Serial.readStringUntil('\n'); //Read available data 
  firstChar = incomingByte.charAt(0); //First character
  //I'd like to differentiate between commands based on first character
  switch(firstChar) {
    case 's': 
    //code
    break;
    case 'b':
      Serial.print("Frequency = ");
      Serial.println(frequency);
    break;
  }
  }       
}

void hall_ISR(){ //Calculate frequency 
  if (micros()-lastTime>debounceTime){ //Debounce time in microseconds
    count++; 
    delta=micros()-lastTime; //Time delta
    lastTime=micros(); 
    digitalWrite(LED_BUILTIN,!digitalRead(LED_BUILTIN)); //Debugging, will remove in final code
  }
  if (count==2){
     frequency = 1000000.0/delta; // Hz = 1/s
  }
  if (count > 2){ //in case we missed a pulse
    count =0;
  }
}

The problem doesn't occur when I remove the 'if' statement from the ISR.

void hall_ISR(){ //Calculate frequency 
    digitalWrite(LED_BUILTIN,!digitalRead(LED_BUILTIN)); //Debugging, will remove in final code
  if (count==2){
     frequency = 1000000.0/delta; // Hz = 1/s
  }
  if (count > 2){ //in case we missed a pulse
    count =0;
  }
}

Any suggestions?

p.s. - I know that my ISR is too long and shouldn't have 'digitalWrite's. Once this problem is fixed I'm planning to minimize and for the calculation to take place in the main loop.

Does the Hall effect sensor need a pull down resistor to stabilize it ? I guess that switching the led is enough to cause the false trigger.

Thanks for the helpful suggestion. I've already added a 4.7K pull-down resistor and the ISR is still initiated whenever serial data is received by the Arduino

Have you tried moving the interrupt to Pin3 which is a little further from Pin1 ?

...R

OK.
You should use unsigned long int (uint32_t) variables for micros() etc.

I'd also try this:

  if (micros()-lastTime>debounceTime){ //Debounce time in microseconds
    count++;
    delta=micros()-lastTime; //Time delta
    lastTime=micros();
    digitalWrite(LED_BUILTIN,!digitalRead(LED_BUILTIN)); //Debugging, will remove in final code
  }
  else return ;  // if it is bounce, we want to leave now

edit

and I guess after this you want to reset count:

frequency = 1000000.0/delta ; // Hz = 1/s

Thanks for the suggestions.
I do indeed need to reset the count and will do that.
Regarding the interrupt on pin 3, I was under the impression that only certain pins on the board could be used for interrupts.

Maybe, you should pull the hall effect sensor output pin high by using the internal pin pullup resistor (INPUT_PULLUP) instead of an external pull down resistor, and look for falling edges instead of rising edges.

Here is an example:

If that doesn't help, show a schematic diagram and say which arduino board and Hall sensor (module) you are using.

Pin 3 can also be used as an external interrupt pin (on a Uno etc.). Most pins can be used as pin change interrupt pins, but that is more difficult to use

A couple of suggestions. First, do not call micros() multiple times in the ISR, call it once and save the value in a variable. Second, do not use the variable frequency directly outside the ISR, disable interrupts, copy frequency to another variable, then re-enable interrupts. This prevents an interrupt from altering the value of frequency while it is being read, which can occur because the processor can only read one byte at a time from a variable that occupies multiple bytes - float is 4 bytes of storage.