XIAO nrf52840 frequency measure is going wrong

Hello.
I want to measure the frequency of a square signal generated by a multimeter.
If i put a 50Hz signal, i expect to measure a period of 20.000micros, but the monitor shows a signal that sometimes is steady around 19.500 and sometimes around 20.500 (not values between these values).
Similar code works in other microcontroller (ARDUINO33IOTSENSE, based in same CPU), but not with this one. Why??

This is the code (sad that we can not post a photo…):
#include <bluefruit.h>

unsigned int tiempoinicial=0;
unsigned int tiempo=0;
int rpmPin = A0;

void isr() //interrupt function
{
tiempo=micros()-tiempoinicial;
tiempoinicial=micros();
}

void setup()
{
Serial.begin(19200);
pinMode(rpmPin, INPUT_PULLUP); //also tried “INPUT”
attachInterrupt(digitalPinToInterrupt(rpmPin),isr,RISING); //Create interruption
}

void loop()
{
Serial.println(tiempo);
delay(500);
}