Problem to get data send by Arduino Micro in Serial Port

Hello! First of all, sorry about my English, i’m brazillian and i dont use English every day :slight_smile:

I have problem using arduino micro.

I wrote a code to arduino, something like a command interpreter. It gets the serial data and if it is a command it execute something and response in the serial port somethig. The code is running 100% in arduino uno, mega and nano.

I wrote too, a code in Delphi 7 (very fast to make a screen test), it has some buttons who sends the command like i do in serial monitor. If i use the arduino uno mega etc, the code and delphi 7 program works very fine, without any problem, and if i test in the arduino Serial monitor it works too.

But if i upload the code to arduino pro micro, i can send the commands from delphi program, arduino micro interprets and do something if its code, but the arduino micro never response! If i test it on Serial monitor, the arduino micro response normally!! I really dont understand what the arduino Serial monitor do to get the response from arduino all the time without problem.

Using arduino micro if i use Serial, the arduino Serial monitor get the data and the delphi program not. If i use the SerialUSB the arduino serial monitor gets all the data every time too, in the delphi program it starts to get the data but after a little time it stops… What should i do?

I already tried to reset arduino micro when i connect to delphi program oppening the serial board at 1200 and closing after that. But doensnt work too. I need help! :frowning:

The Uno, Mega and Nano all restart when the PC program opens the Serial Port but the Micro does not. That may be the problem. You can force the Micro to reset by opening the Serial port at 1200 baud and then closing it again before opening it at the normal baud rate.

Another possible problem is that your PC program may need to set DTR and RTS when it opens the serial port.

if none of that works then you need to post your Arduino program.

...R

Thank you for your fast repply!

I already tried to reset before connect, using the 1200 baud opening and closing the port. But the arduino stay in the bootloader for something like 8s then start the code. INarduino serial monitor doesnt do that, cause when i start the serial monitor the micro doenst restart, it run directly the code!

Arduino serial monitor set the DTR and RTS in every serial connection?

Robin2:
The Uno, Mega and Nano all restart when the PC program opens the Serial Port but the Micro does not. That may be the problem. You can force the Micro to reset by opening the Serial port at 1200 baud and then closing it again before opening it at the normal baud rate.

Another possible problem is that your PC program may need to set DTR and RTS when it opens the serial port.

if none of that works then you need to post your Arduino program.

...R

Thank you for your fast repply!

I already tried to reset before connect, using the 1200 baud opening and closing the port. But the arduino stay in the bootloader for something like 8s then start the code. INarduino serial monitor doesnt do that, cause when i start the serial monitor the micro doenst restart, it run directly the code!

Arduino serial monitor set the DTR and RTS in every serial connection?

LynconKusminski:
I already tried to reset before connect, using the 1200 baud opening and closing the port. But the arduino stay in the bootloader for something like 8s then start the code. INarduino serial monitor doesnt do that, cause when i start the serial monitor the micro doenst restart, it run directly the code!

I send a short message from setup() and my PC program waits for that message to know that the Arduino has restarted.

Arduino serial monitor set the DTR and RTS in every serial connection?

I think it does.

...R

PS. Don't double post. I have suggested to the Moderator to delete your other Thread with the same question.

Robin2:
I send a short message from setup() and my PC program waits for that message to know that the Arduino has restarted.
I think it does.

...R

PS. Don't double post. I have suggested to the Moderator to delete your other Thread with the same question.

Sorry! i wrote the other topic, but i can't find it. So i wrote this..

BY THE WAY!! I found the solution in this topic -> http://forum.arduino.cc/index.php?topic=143028.0

Just need to comment the lines 224 and 232 from CDC.cpp(\Arduino\hardware\arduino\avr\cores\arduino) file! And works like a charm!

Maybe it works by NOT connecting DTR/CTS but only Tx, Rx and GND (and also 5V if you need the power) if you're not programming the device. Those three wires are all you need for serial communication.

DTR/CTS are needed for programming, otherwise it won't get into program mode.

LynconKusminski:
BY THE WAY!! I found the solution in this topic -> http://forum.arduino.cc/index.php?topic=143028.0

As far as I can see that Thread is also consistent with what I suggested in Reply #1

I prefer not to muck about with the Arduino files because the next time you download a new version you will have to modify that as well.

...R