Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Serial output sets wrong baud rate (Read 13124 times)
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Serial output sets wrong baud rate
Apr 9th, 2017 at 12:24am
Print Post  
My program has the line
Serial.begin(9600);

When I build and upload in VS/VM the data speed sets to 115200.  How do I get the speed I have programmed for?

Thanks
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial output sets wrong baud rate
Reply #1 - Apr 9th, 2017 at 3:01pm
Print Post  
Hi,

This means you have debugging enabled. Switch the tool bar from Debug to Release and then upload again. In this case you will have full control of the speed via the serial monitor.

With Debug enabled the default state is to share the serial port. In this case the speed can be configured using the "vMicro>Debugger>Local Speed" and "Remote Speed" menu items.

  
Back to top
IP Logged
 
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Re: Serial output sets wrong baud rate
Reply #2 - Apr 10th, 2017 at 12:30am
Print Post  
Tim@Visual Micro wrote on Apr 9th, 2017 at 3:01pm:

With Debug enabled the default state is to share the serial port. In this case the speed can be configured using the "vMicro>Debugger>Local Speed" and "Remote Speed" menu items.


I don't have those options.  All I get from vMicro is shown in the attached image.

  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial output sets wrong baud rate
Reply #3 - Apr 10th, 2017 at 2:28pm
Print Post  
1)
Did you understand about using Release instead of Debug for normal usage?

2)
What is on the Debugger menu that is shown in your image?
  
Back to top
IP Logged
 
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Re: Serial output sets wrong baud rate
Reply #4 - Apr 10th, 2017 at 11:33pm
Print Post  
Tim@Visual Micro wrote on Apr 10th, 2017 at 2:28pm:

1)
Did you understand about using Release instead of Debug for normal usage?

No, I don't understand the significance.  I have only used VS in Debug Mode.

Tim@Visual Micro wrote on Apr 10th, 2017 at 2:28pm:

2)
What is on the Debugger menu that is shown in your image?

See attached.

  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial output sets wrong baud rate
Reply #5 - Apr 11th, 2017 at 11:44am
Print Post  
1)

Quote:
No, I don't understand the significance.  I have only used VS in Debug Mode.


Debug mode gives debug facility Release mode is same output as Arduino IDE

2)

When debug is enabled, please see the Override Local Speed in the image you posted.



  
Back to top
IP Logged
 
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Re: Serial output sets wrong baud rate
Reply #6 - Apr 12th, 2017 at 1:08am
Print Post  
Tim@Visual Micro wrote on Apr 11th, 2017 at 11:44am:
1)
When debug is enabled, please see the Override Local Speed in the image you posted.


I build and upload a program and it only outputs trash.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial output sets wrong baud rate
Reply #7 - Apr 12th, 2017 at 1:10am
Print Post  
Hi,

Please uncheck "automatic debugging" then click build and upload

Thanks
« Last Edit: Apr 12th, 2017 at 1:10am by Tim@Visual Micro »  
Back to top
IP Logged
 
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Re: Serial output sets wrong baud rate
Reply #8 - Apr 12th, 2017 at 2:53am
Print Post  
Tim@Visual Micro wrote on Apr 12th, 2017 at 1:10am:
Please uncheck "automatic debugging" then click build and upload


Did that and the program does absolutely nothing.  No Serial Output, no program action.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial output sets wrong baud rate
Reply #9 - Apr 12th, 2017 at 8:59am
Print Post  
The output you have posted shows a successful build and upload to your micro-controller.

You should manually open the Serial Monitor when you want to use it (which is how the arduino ide also works). 

If you do not see any data in the Serial Monitor then make sure the DTR button on the Serial Monitor is checked.

Thanks
  
Back to top
IP Logged
 
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Re: Serial output sets wrong baud rate
Reply #10 - Apr 13th, 2017 at 7:57am
Print Post  
Tim@Visual Micro wrote on Apr 12th, 2017 at 8:59am:
The output you have posted shows a successful build and upload to your micro-controller.

I'll take your word for that, but built and uploaded code does nothing.
These two programs two-way communicate using Arduino Boards and nRF24L01+ RC breakouts.  Noting happens if I upload PRX - there is no reaction in PTX,

Tim@Visual Micro wrote on Apr 12th, 2017 at 8:59am:
You should manually open the Serial Monitor when you want to use it (which is how the arduino ide also works).

I have Serial Monitor parked to right of code window.

Tim@Visual Micro wrote on Apr 12th, 2017 at 8:59am:
If you do not see any data in the Serial Monitor then make sure the DTR button on the Serial Monitor is checked.

DTR button is checked.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial output sets wrong baud rate
Reply #11 - Apr 13th, 2017 at 10:15am
Print Post  
Does it work from the arduino ide?

I think you are saying there is no serial. Your previous log showed the compiler is good and upload is good.

Code
Select All
Program backChatProject size: 444 bytes (used 1% of a 32,256 byte maximum) (0.37 secs)
Minimum Memory Usage: 9 bytes (0% of a 2048 byte maximum)

Uploading 'backChatProject' to 'Arduino/Genuino Uno' using 'COM4'
Uploader started for board Arduino/Genuino Uno
Upload method will be: bootloader
Uploading via Bootloader
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude -V "-CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -v -patmega328p -carduino -PCOM4 -b115200 -D ackChatProject.ino.hex:i"
avrdude: Version 6.3, compiled on Sep 12 2016 at 17:24:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch
         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"
         Using Port                    : COM4
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 4.4
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% -0.00s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading input file ject.ino.hex"
avrdude: writing flash (444 bytes):
Writing | ################################################## | 100% 0.08s
avrdude: 444 bytes of flash written
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (E:00, H:00, L:00)
	The upload process has finished.
avrdude done.  Thank you. 

« Last Edit: Apr 13th, 2017 at 11:23am by Tim@Visual Micro »  
Back to top
IP Logged
 
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Re: Serial output sets wrong baud rate
Reply #12 - Apr 13th, 2017 at 11:10pm
Print Post  
Tim@Visual Micro wrote on Apr 13th, 2017 at 10:15am:
I think you are saying there is no serial.


I am saying that nothing happens.  The PTX program is running under the Arduino IDE and Serial Monitor.  That shows the PTX start up as usual and wait for a transmission from PRX.  Nothing happens!

Somehow, the program VS/vM uploads does not run.  This does not happen if I run both programs under the Arduino IDE.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial output sets wrong baud rate
Reply #13 - Apr 14th, 2017 at 10:14am
Print Post  
Okay please switch on file>preferences>compile verbose and upload verbose in the arduino ide. Then upload and right click the output>select all>copy. Copy into a new .txt text file.

Then in visual micro switch on vmicro>compiler>verbose and copy the output into a .txt text file

Email the .txt files to to info@visualmicro.com along with a link to this post.

Thanks
  
Back to top
IP Logged
 
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Re: Serial output sets wrong baud rate
Reply #14 - Apr 15th, 2017 at 12:19am
Print Post  
All sent.

Happy Easter
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial output sets wrong baud rate
Reply #15 - Apr 15th, 2017 at 12:37am
Print Post  
Thanks  Smiley

Okay the problem is you have got into a bit of a muddle with project names and source code.

Both your visual micro projects compile as arduino project but with NO code other then empty setup() and loop()

The Arduino projects compile okay because you have opened them from their correct locations.

Both of the Visual Micro project outputs are for a project name backChatProject and an .ino called backChatProject.ino

In the Arduino Ide they are called backChatProject\backChatPTX\backChatPTX\backChatPTX.ino etc.

So hopefully you an see you are compiling different code in visual studio than in arduino.

I suggest you close all ides. use windows explorer to clean things up.

Have this type of folder structure.

\backChatProjects\backChatPTX\backChatPTX.ino
\backChatProjects\backChatPRX\backChatPRX.ino

Delete all .sln, vcxproj, .vcxprojuser .sla files. Make sure you don't delete your source code.

Open visual studio. Do not open a project

Click file >open >arduino project and open backChatPTX.ino

Then again Click file >open >arduino project and open backChatPRX.ino

You will have a solution containing the two arduino projects

Click the solution node in the solution explorer, then click "file > save as"

Save the solution with a name of your choice in the backChatProjects folder.

After doing this you will get to understand how visual studio projects and solutions work.

Hope that makes sense.
  
Back to top
IP Logged
 
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Re: Serial output sets wrong baud rate
Reply #16 - Apr 15th, 2017 at 1:40am
Print Post  
Pleased to report all is running just fine.
Can't understand how it worked fine for months then discovered this problem.  I guess we'll write that one off to the Computer Fairies.  Wink

Thanks for the prompt help.
Happy Easter
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial output sets wrong baud rate
Reply #17 - Apr 15th, 2017 at 2:39pm
Print Post  
Great. 

A suggestion would be to switch off the "show build properties" but leave the "verbose" on. Then take a little time to study the build outputs.

You will clearly see which libraries are being used. An indication of the problem for you was an empty project because there were no libraries mentioned in the output (ie: Using library xyz). Don't try to hard to read the lines of the output that are difficult to read, just look for english messages (notes) within the output about what is being compiled.

In all situations (with or without verbose) visual micro and arduino show the final program size. In your case the empty project you were compiling in visual studio had a very small program size and the correct project you were compiling in the arduino ide showed a much larger program size. 

The build output also shows the name of the sketch/project that is being compiled (Especially towards the end of the compile). In this case the two ide's were compiling different project (.ino and folder) names

So these tips give you a way to see exactly what is going on and avoid it being a black box.

Thanks for the update.
« Last Edit: Apr 15th, 2017 at 2:46pm by Tim@Visual Micro »  
Back to top
IP Logged
 
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Re: Serial output sets wrong baud rate
Reply #18 - Apr 16th, 2017 at 1:28am
Print Post  
Thanks again Tim.

VS/vM working fine.  Just one thing.  I have to start Serial Output manually each time round.  Can I get it to start automatically on 'Build and Upload'?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial output sets wrong baud rate
Reply #19 - Apr 17th, 2017 at 7:52pm
Print Post  
There is not yet an option in Release mode to auto open the serial after upload. However you can open the serial monitor manually and then each upload will disconnected and reconnect without need to open and close. I guess it's not ideal if you often close the serial monitor.

or

Now that we have resolved the confusion you can switch debugging back on with vMicro>debugging>automaytic debugging

Then ensure you are using the Debug configuration on the tool bar and not Release.

If your code has an obvious serial.begin with fixed value visual micro will automatically use that for debug speed otherwise set the vMicro>Debugger local and remote override speed to match your project code or change your project code to match the visual micro default speed of 115200.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint