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
Normal Topic Wrong Baud rate with Teensy3.1 (Read 4367 times)
RogerW
Junior Member
**
Offline


Posts: 19
Location: Egnach
Joined: Jan 4th, 2014
Wrong Baud rate with Teensy3.1
Jul 11th, 2014 at 9:51pm
Print Post  
Hi

I got Teensy 3.1 with Teensyduino 1.19, Atmel Studio 6.1.2730 SP2, VisualMicro 1.1407.08 and Arduino 1.0.5-r2 installed.
In Define Project I've got: F_CPU=96000000;USB_SERIAL;LAYOUT_US_ENGLISH 

I've got this test sketch:
<<<
void setup()
{
     Serial2.begin(57600);
}

void loop()
{
        delay(1000);
     Serial2.println("AB");
}
>>>

When I measure the Baud Rate with the Oscilloscope I get 86956 instead of 57600. The same Sketch compiled and uploaded from the Arduino IDE works correctly. It seems that the CPU clock ist not taken into account with Atmel Studio, I also noticed that the CPU clock defined in Define Project is not taken into account (does not matter what number I put there). Again this works with Arduino IDE.


Am I missing something? 
Thanks for your help.
Roger

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


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Wrong Baud rate with Teensy3.1
Reply #1 - Jul 11th, 2014 at 10:17pm
Print Post  
Hi Roger,

Sorry to hear of your issue.

Please switch on tools>options>visual micro>compiler>verbose and then compile. The output will show a few files being compiled. please post the entire output for one file (any one). 

This will show clearly what values are being passed to the compiler and provide a clue to the problem.

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


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Wrong Baud rate with Teensy3.1
Reply #2 - Jul 11th, 2014 at 10:26pm
Print Post  
I've just tested it and it appears to work correctly.

Did you use a faster speed for a previous compile?

If so then it would be a good idea to click "Build>Clean Solution". This will remove the temp compiler files and force the core to recompile.

If you do change the defines often then there are two project properties in the "Micro Optimization" category called "Project Defines Affect Core" and "Project Defines Affect Libraries". Setting these to true would automatically perform a build clean prior to compile if the project defines have changed.

I hope this makes sense and proves to be the issue. I will add this to the Teensy documentation page.

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


Posts: 19
Location: Egnach
Joined: Jan 4th, 2014
Re: Wrong Baud rate with Teensy3.1
Reply #3 - Jul 12th, 2014 at 8:43am
Print Post  
Hi

Thanks for the very fast response.

Yes, I played with different speeds or let's say tried to... The Build>Clean Solution did the trick and the Baudrate is spot on.

Adding this to the Teensy documentation page is a plus for sure.

Thanks again
  
Back to top
 
IP Logged
 
RogerW
Junior Member
**
Offline


Posts: 19
Location: Egnach
Joined: Jan 4th, 2014
Re: Wrong Baud rate with Teensy3.1
Reply #4 - Jul 12th, 2014 at 8:55am
Print Post  
With the Option "Project Defines Affect Core" = True the changes in CPU clock Speed in the Project Defines are taken into account -> all works fine.  Cool

Is there a possibility to have "Project Defines Affect Core" = True as Default for new Projects?

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


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Wrong Baud rate with Teensy3.1
Reply #5 - Jul 12th, 2014 at 2:40pm
Print Post  
Thanks for the feed back. 

I don't think making it the default will have any detrimental affect on normal Arduino users so makes sense.

and yes it has been added to the Teensy doc! 

Smiley
« Last Edit: Jul 12th, 2014 at 2:41pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint