Different behavior between nano and nano every

I observed strange different behavior between nano and nano every board. Step 1 and 2 are OK, but step 3 is different and step 4 is not working on nano.

The nano came up at /dev/ttyUSB1 port
The nano every came up at /dev/ttyACM0 port

  1. After upload to the boards, both led blink at 100ms, OK

  2. Use the tools->Serial monitor to write number 1000
    They both blink at 1000ms, and serial monitor shows the 1000 sent back from the board.
    OK

  3. Use python only connect the serial port
    python t1.py /dev/ttyUSB1
    this reset the nano to blink at 100ms
    python t1.py /dev/ttyACM0
    this does not reset the nano every, it still blink at 1000ms

It seems the auto-reset feature is different between the nano and nano every

  1. Use python to change the speed to 500ms

python t1.py /dev/ttyUSB1 500
This does not seems do anything, the board blink at 100ms, , and the python stuck at waiting for serial response. I have to ctrl->c to stop it.

python t1.py /dev/ttyACM0 500
This does change the blink speed to 500ms.

Why are they different?

I am using ARDUINO GUI 1.8.16 on a debian computer.

The sketch

int delayms=1000;
// the setup function runs once when you press reset or power the board
void setup() {
  Serial.begin(9600);
  pinMode(LED_BUILTIN, OUTPUT);
  delayms=100;
  
}

void loop() {
  if (Serial.available()>0){
    delayms=Serial.parseInt();
    Serial.println(delayms);
  }
  
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(delayms);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(delayms);                       // wait for a second
}

Python code t1.py

import time
import sys
import serial
ser=serial.Serial(sys.argv[1],9600)
ser.flushOutput()
ser.flushInput()
time.sleep(0.1)
if len(sys.argv)>2:
    ser.write(sys.argv[2].encode())
    while ser.in_waiting==0:
        time.sleep(0.1)
    print(ser.read(ser.in_waiting))
input()

yes, those are very different boards

Regarding the auto-reset, is that true the nano do the auto-reset when the serial port connected but the nano every does not do it?

From the schematic, the nano has the USB DTR pin connected to the reset via a 100u capacitor; the nano every does not have that.

Is that the reason for the different reset behavior?

yes classic Nano does the auto-reset.
on Nano Every the reset is done with the 1200 baud rate 'touch' as on boards with native USB even if the USB is handled by a separate chip. Opening the USB connection doesn't reset the Every. But there is a newer version of the USB firmware which resets the ATmega on DTR signal.

Thank you for the info.

Opening the USB connection doesn't reset the Nano.
. ................................................................................^^^^^
Do you mean the nano every here?

But there is a newer version of the USB firmware which resets the ATmega on DTR signal.

This ATmega means the ATMEGA328 in nano or ATMEGA4809 in nano every? I guess the ATMEGA328, right?

sorry, only the first line s about classic Nano

If you're looking for a way to reset your Nano Every from your python script, you can use the below. Note that I'm not a python programmer and I don't have a Nano Evevy to test.

# reset
ser=serial.Serial(sys.argv[1],1200)
time.sleep(5)
ser.close()
# wait for bootloader to timeout
time.sleep(5000)
ser=serial.Serial(sys.argv[1],9600)

You might have to adjust the delays in above code.

If you want to know in your python script that the Arduino was reset, let the Arduino send a message in setup() and wait for that message to arrive in the python script.

Serial.parseInt() is an unreliable way to read a number. You can get some ideas from Robin's Serial Input Basics - updated