Strange Interrupt behavior on IO
Posted: Sat Aug 26, 2017 9:11 am
I'm in the process of migrating dome ESP8266 code to ESP32 and face a strange Interrupt handler behavior.
The ESP32 is connected to an external system - hoverboard. The hall sensors, detecting wheel movements raise a square signal. I connect the 3 signal to 3 input pins on ESP32. I'm using a very simple sketch:
I was expecting to see something like 012012012012012 for a movement in one way, 021021021021021 in the other side. I have this behavior on ESP8266.
But I'm seeing output like:
It appears the riding interrupt is shouted several times.
The signal, seen with a logic analyser is clean: I'm wondering if there is something needed in EPS32 different from ESP8266 to have a correct behavior, or what I have missed.
The ESP32 is connected to an external system - hoverboard. The hall sensors, detecting wheel movements raise a square signal. I connect the 3 signal to 3 input pins on ESP32. I'm using a very simple sketch:
Code: Select all
int pin[] = {15, 4, 16};
void setup() {
// put your setup code here, to run once:
for (int i=0; i<3; i++) {
pinMode(pin[i], INPUT);
}
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
attachInterrupt(pin[0], pin0LChanged, RISING );
attachInterrupt(pin[1], pin1LChanged, RISING );
attachInterrupt(pin[2], pin2LChanged, RISING );
}
void pin0LChanged() {
Serial.print("0");
}
void pin1LChanged() {
Serial.print("1");
}
void pin2LChanged() {
Serial.print("2");
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
Serial.println("-- ");
}
But I'm seeing output like:
Code: Select all
--
122222222222211111111111--
00000000012222222222111111111120000000000222222222111111111--
000000000000111111111122222222220000000001111111111--
22222222221111111111120000000000222222222222--
111111111111000000000000--
--
The signal, seen with a logic analyser is clean: I'm wondering if there is something needed in EPS32 different from ESP8266 to have a correct behavior, or what I have missed.