External interrupts are not working when UART is disconnected.

Salakhov
Posts: 11
Joined: Sat Aug 24, 2019 2:08 pm

External interrupts are not working when UART is disconnected.

Postby Salakhov » Wed Apr 07, 2021 12:48 am

Hi,
The scetch is working correctly when UART is connected to computer.
And does not work when UART is disconnected.
What is a reason?
Thanks.

Power is independent.
USB-TTL adapter has 4 wires (GND, RX, TX, DTR)



byte ledPin1 = 4;
byte ledPin2 = 16;
byte ledPin3 = 23;

byte interruptPin1 = 39;
byte interruptPin2 = 36;
byte interruptPin3 = 34;

volatile byte state1 = LOW;
volatile byte state2 = LOW;
volatile byte state3 = LOW;

void setup() {
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);

pinMode(interruptPin1, INPUT);
pinMode(interruptPin2, INPUT);
pinMode(interruptPin3, INPUT);

attachInterrupt(digitalPinToInterrupt(interruptPin1), blink1, CHANGE);
attachInterrupt(digitalPinToInterrupt(interruptPin2), blink2, CHANGE);
attachInterrupt(digitalPinToInterrupt(interruptPin3), blink3, CHANGE);
}

void loop() {
}

/* interrupt function toggle the LED */
void blink1() {
state1 = !state1;
digitalWrite(ledPin1, state1);
}
void blink2() {
state2 = !state2;
digitalWrite(ledPin2, state2);
}
void blink3() {
state3 = !state3;
digitalWrite(ledPin3, state3);
}

Salakhov
Posts: 11
Joined: Sat Aug 24, 2019 2:08 pm

Re: External interrupts are not working when UART is disconnected.

Postby Salakhov » Thu Apr 08, 2021 6:53 am

SOLVED!

I sequantionally diconnected DTR, RX, TX from board.
Surprising for me the board is continueing to work correctly.
After connecting GND to AC ground the board became
to work stabile.

Who is online

Users browsing this forum: No registered users and 66 guests