Go Down

Topic: Cannot restore serial connection after resetting the board (Read 389 times) previous topic - next topic

_guybrush_

Hello,

I am using an arduino micro in a project, which involves a user interface on a computer, and communication between the computer and the Arduino micro over the serial link. Now in some rare circumstances, the code running on the micro must be rebooted (mainly linked to configuration changes to device connected to the micro, but this is beyond the point). The reset is currently done using a watchdog timer.

Now I noticed the following strange behaviour:
On MacOS, when the micro resets, the serial communication is (logically broken), but it can be re-opened easily. For example, if using the IDE's serial monitor, once the board has resetted, I just need to close the serial monitor window and open a new one to re-establish connection with the microcontroller.

On Windows 7 (and to be precise this is on my Mac via bootcamp, don't know if this can be the issue). Once the micro has rebooted, I cannot open a new serial monitor window. The port appears in my device manager, but the Arduino IDE say Board at COMX is not available. (and if I use another software for serial connection, it indeed also says that the port is in use). The only possibility is to unplug the USB cable and to replug it?
Is this the expected behaviour?

Thanks for your help.

zoomkat

Quote
Is this the expected behaviour?
Somewhat. If the serial port on the pc is not closed, then it is still in use. Rebooting the arduino has no control connection with the serial port on the pc. They are just independent devices connected with wires with no particular knowledge of what the other is doing. Disconnecting the USB connector from the pc will deenergize the  USB/serial chip on the arduino, which may free that virtual comport on the pc. If an application on the pc nis still using that comport, that comport may not be available to another application until the pc program is closed. If USB connector is plugged back in and the pc is still using the origional comport, then the USB/serial adapter of the arduino will probably be assigned a virtual comport of another number.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

DrAzzy

Windows doesn't like it when serial ports with active connections vanish out from under it. You typically have to unplug and replug to make it work, and I've seen it get into states where you need to reboot to revive it.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

_guybrush_

What surprises me is that I close the connection before the reset. I have used the 2s delay watchdog, and I send a command to reboot via the serial link, and then close the port. At this time the arduino is still listening. I have used a port sniffer, which shows that the port has indeed been closed.

I'll make a few more tests tomorrow (don't have the unit with me now), and try to give a more accurate description of what happens.

Go Up