Go Down

Topic: Connection closed by foreign host (Read 65327 times) previous topic - next topic

simon_schvartzman

When I double click the 32U4 Reset switch hoping to reset the Arduino I get the message "Connection closed by foreign host" but the Arduino sketch doesn't start again.

Any hint on what I'm missing?

Many thanks!

Simon

federicofissore

Can you post some more detail about which sketch are you running? Also: where do you get that message (browser, serial monitor, ssh session...)? And which button are you pressing?

simon_schvartzman

Federico, Im pressing the switch close to the Ethernet connector, I'm getting the error message on the serial monitor (wifi connected) on any sketch.

Hope it helps.. Many thanks for your responses

simon_schvartzman

Federico, just to be more specific, it happens with the ConsolePixel example (untouched)...

Cheers!

federicofissore

Ah ok, I think you've spotted a corner case that breaks the Serial Monitor when using wifi.
If I get it right, you have opened the serial monitor and then you reset the 32u4.
That won't work right now (and I reckon it doesn't work in general when using serial monitor with usb cables). Once you reset the 32u4, the bridge restarts, restarting the console as well: that's why connection broke
A workaround is to first reset the 32u4 and only then open the serial monitor. Can you give it a try?

simon_schvartzman

Thanks Federico, you got it exactly right and your workaround did the trick.

Cheers!

woodstock

Hi,

I have a similar problem. In particular I'd like to use the watchdog command.

With the arduino yun I read a value from an external input and I send the value every 10ms using the Console. I open the serial monitor and I can see the values. However, after a short time (30-60sec) the routine stops. Using the Serial communication, this problem doesn't happen.

So, I decide to use the watchdog, in such a way to reset the MCU when I have an interruption longer than 1 second. But, on the serial monitor I receive the message "Connection closed by foreign host".

How can I solve this trouble? Thanks!

ShapeShifter

Don't worry about the connection closed message. That is an expected side effect of rebooting the Yun with the watchdog: you had a connection open, you reset the Yun which closed the connection, and the serial monitor is reporting that. That part is working as it should.

Instead, concentrate on finding and correcting the reason that the watchdog trips and resets the processor. I suspect that sending data every 10 ms is overloading the network connection and causing something to overflow. The network connection has more overhead than the USB, so it probably can't handle as much bandwidth? But it's just a guess.

Go Up