VS Arduino | |
>> >> Software serial can't receive messages when debugging?
https://www.visualmicro.com/forums/YaBB.pl?num=1579231013 Message started by fantasyhpu on Jan 17th, 2020 at 3:16am |
Title: Software serial can't receive messages when debugging? Post by fantasyhpu on Jan 17th, 2020 at 3:16am
Hi, I want to debug arduino uno, I followed the instructions posted in arduino project hub:
https://create.arduino.cc/projecthub/visualmicro/arduino-uno-debugging-f4d470?f=1 and my test code is: Code (c++):
The serial port used to upload the sketch is COM9, and the serial port generated by the USB-to-Serial board is COM7. When debugging, I can get the messages output by "USE_SERIAL.println(fieldIndex);", but the COM7 can't receive the messages I send to it (the message is "12,1,3"), as the test.git file illustrated, so the "debug arrow" can't enter the "if (USE_SERIAL.available()) {...}" statement. For a test, I quit the debug session, and upload the code to arduino uno, then I open serial monitor and select COM7 and click the "Connect" button in the "Serial | COM7" window, typing "12,1,3", then click the "send data to the connected device", I find that the software serial works very well. But why the software serial port can not receive messages in the debug session? Can anyone tell me how to do with it? Best regards. |
Title: Re: Software serial can't receive messages when debugging? Post by Simon Hopkinson on Jan 17th, 2020 at 10:41am
This may be a limitation of the GDBStub Implementation (receiving data), as when it is paused on a break point, there are no interrupts happening either.
The Serial Debugger may be a better option for the Uno in this case, and it allows changing data on the fly when sat on a break point as you require. To move to this select "Debug: Serial", and remove the GDBStub changes and library from your code. The Serial debugger requires re-upload of the code when breakpoints are edited or added, so add in the points to stop or trace now. Variables can be added for editing using the Breakpoint Actions and {variableName} syntax. An example video showing this feature (used for calibration often) is on Youtube Here. Further Info: Serial Debugger Serial Debug Breakpoint Actions |
Title: Re: Software serial can't receive messages when debugging? Post by fantasyhpu on Jan 17th, 2020 at 11:48am Simon@Visual Micro wrote on Jan 17th, 2020 at 10:41am:
Hi, thank you very much for tellimg me the reasons. Best regards. |
VS Arduino » Powered by YaBB 2.6.12! YaBB Forum Software © 2000-2024. All Rights Reserved. |