Serial communication stops, does not let to update code

Hi,

I am running a Rosserial program (source in https://github.com/rezeck/ros_tamiya/blob/master/firmware/firmware.ino) and after a while, particularly when sending data to the Arduino, the serial communication with the computer stops. I see that the TX led stops blinking, but I know the program is running because I have set a led that blinks inside the main loop (and it never stops).

After the serial stops, I cannot update the software inside the Arduino either, the only thing that works is connect and reconnect the board to the USB port.

A curious thing: Im on ubuntu 14.04.4 and when the problem arises and I remove and plug again the Arduino, linux list it as another device number (/dev/ttyACM1... 2... 3...4).

Maybe its a problem with my Arduino? Its something that can be fixed with an upgrade of the bootloader or something? Thanks!

Hi, and welcome.
Do you have connected something on serial port? If so, disconnect all things and try. Also you can try the loopback test. Here is an instruction Loop-Back Test Instructions - Installation & Troubleshooting - Arduino Forum. This make you sure that the serial circuit works. The second, you have to checkup the bootloader. The bootloader should flick the L LED 3x immediately after reset. This is indication at least that the bootloader is present in flash memory and starts.

Let to know.

Possibly the USB port being powered off.

Hi,

I did the serial test as recommended by Budvar10

Budvar10:
... try the loopback test. Here is an instruction http://forum.arduino.cc/index.php?topic=73748.0 ...

but despite the test run successfully the intermittent serial connection remains. I have found that the problem with the serial enumeration was that avrdude was still trying to write to the serial port despite the serial port was disconnected and the upload was unsuccessful.

I have temporarily fix the issue running my sketch on an Arduino Uno r3. So It must me that my Arduino mega has a problem!

but despite the test run successfully the intermittent serial connection remains

OK, it means that the serial converter works.
You have another Arduino, so what about to try check the Mega via ISP port with Arduino as ISP? Try to read fuses and flash with avrdude.