Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Baud Rate for IDE Serial Monitor

Hybrid View

  1. #1
    Senior Member
    Join Date
    Mar 2015
    Location
    UK
    Posts
    301

    Baud Rate for IDE Serial Monitor

    Am I correct in thinking that setting the Baud Rate for the Teensy port to the Arduino IDE Serial Monitor (e.g. "Serial.begin(115200);") over the mini USB is rather academic?

    I wrote my own Serial Monitor yesterday to run on a Win7 host PC using Delphi/Pascal because I wanted to log data direct to a Hard Drive text file. The Commport component available to me was very old and the highest speed in its own Baud Rate setting was 38400. So I was a bit surprised when it actually worked fine.

    It set me wondering. If I'm using virtual comm ports under Win7, then what relevance is the selected speed for Teensy code? The USB interface is sending USB packets back and forth in any case, and that's more likely to be at 480 Mbits/sec rather than any slow baud rate.

    Or will the Teensy actually slow down transmission if I set, say, "Serial.begin(9600);" ?

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,967
    That baud is only used when talking to an FTDI thing that interfaces USB to MCU Serial on the other end - it passes that to set the serial interface baud on that chip.

    When going USB to a Teensy USB device it runs at the native Teensy USB speed 12 or 480 Mbps

  3. #3
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    546
    Am I correct in thinking that setting the Baud Rate for the Teensy port to the Arduino IDE Serial Monitor (e.g. "Serial.begin(115200);") over the mini USB is rather academic?
    In case you are interested: here is the definition of Serial.begin... Useful if you want your code to be compatible to legacy boards, but if you code for a Teensy it is rather pointless to call it :-)

    Code:
    class usb_serial_class : public Stream
    {
    public:
    	constexpr usb_serial_class() {}
            void begin(long) {
    		//uint32_t millis_begin = systick_millis_count;
    		//disabled for now - causes more trouble than it solves?
    		//while (!(*this)) {
    			// wait up to 2.5 seconds for Arduino Serial Monitor
    			// Yes, this is a long time, but some Windows systems open
    			// the port very slowly.  This wait allows programs for
    			// Arduino Uno to "just work" (without forcing a reboot when
    			// the port is opened), and when no PC is connected the user's
    			// sketch still gets to run normally after this wait time.
    			//if ((uint32_t)(systick_millis_count - millis_begin) > 2500) break;
    		//}
    	}
    ....

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,688
    The number you use in Serial.begin(baud) is completely ignored.

    The baud rate setting on the PC side is also not used for the USB communication speed. But it is communicated to Teensy, so your code can read it with Serial.baud(). That's useful if you want to relay the communication to a real hardware serial port and you want Teensy to automatically use the PC's baud rate setting on that real serial port.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •