Go Down

Topic: Reset Nano Every - Toggling RTS and DTR doesn't do it (Read 487 times) previous topic - next topic

leapwill

What signals do I need to send to reset the Nano Every?

I switched a project from an Uno to a Nano Every. I'm using pySerial in Python 3.7. In its FAQ, it says it toggles RTS and DTR when it opens the port. This works fine on the Uno. When I put the Nano Every in, it does not reset. I found an AVRFreaks forum post that says toggling DTR at 1200 baud works. The following code resets the Uno after the sleep, but the Nano Every does nothing.


ser = serial.Serial()
ser.port = 'COM8'
ser.baudrate = 1200
ser.setRTS(False)
ser.setDTR(False)
ser.open()
time.sleep(5)
ser.setRTS(True)
ser.setDTR(True)

leapwill

I found a workaround that works for my project: resetting from within the sketch.

Here is a post on this form, and here is a post on Arduino StackExchange.

Note that the method using a digital I/O pin wired to the RESET pin is not advised by the chip manufacturer, Atmel. Also note that a few things do not get reset by these methods.

Here's the snippet I used (#10 on this forum and method 2 on StackExchange):

Code: [Select]

asm("jmp 0");


The context for this in my project is that I have the PC program and Arduino do a short handshake over serial. If the Arduino receives no response in 5 seconds, it starts over.

Riva

That works but the ideal way is to use the WDT as long as you observe the caveats as outlined here .
Don't PM me for help as I will ignore it.

sterretje

No experience with the Nano Every. But it's my understanding that it basically works the same as e.g. Leonardo.

In that case, there is no need for DTR or others. Opening the port at 1200 baud and closing it should do the reset.

1)
If you enable 'verbose output during upload' in file -> preferences in the IDE, you can more or less see this. I suspect you will see a line stating something like "Performing reset at 1200 baud" (no board at hand to test).
2)
You can test this with a terminal program (e.g. realterm under windows).
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Go Up