change console serial speed/baud?

Posted on
  • I can't imagine this hasn't come up before, but I searched and came up empty. So, apologies for what is surely a repeat!

    Is there some easy way to set the speed of the console serial port? 115,200 is really nice when working on the ESP8266. Surely the STM32 family can handle that -- and I'd expect much faster.

    I'd love to be able to set my Pico to 115,200. I'm guessing I can do it with the right call to Serial.setup() maybe, but I don't know the particulars of setting up the port to talk to the IDE (bits, parity, etc.).

  • Yes, it's literally just Serial1.setup(115200) that you need. Then you can connect to the IDE at 115200 baud using the B6/B7 pins and a USB-TTL converter.

    However are you connected via USB? If so, the console on USB ignored the baud rate and is already running as fast as possible over the USB connection - it should be way faster than 115200 baud.

  • Well, not sure about the details of USB... NOT connected directly to the STM32 via the direct USB support. Rather, I'm connected via USB to a Prolific USB->Serial chip on the board that then connects via normal serial to UART function on two pins on the STM32.

    This is an HY-STM32V with the 3.2" touchscreen. The serial connection from the USB chip is connected to pins A9/A10 TX/RX.

    I tried what you posted above, and got this result:

    >Serial.setup(115200)
    Uncaught Error: Function "setup" not found!
     at line 1 col 8
    Serial.setup(115200)
           ^
    > 
    

    Reviewing the Serial class documentation, this makes sense -- don't I have to have an actual instance of the Serial class to use it? The documentation talks about pre-instantiated instances Serial1, Serial2, ... and USB.

    So, still stuck. And, there's no doubt it's 9600 baud :-)

    My main issue here is that at 9600 baud loading the GUI code I'm developing takes a long time, which is painful with edit/test cycles.

  • Gordon, here's some more interesting "things": There are two USB connections on the MiniSTM32V; one goes through the Prolific chip and connects to a pins configured as a UART. This is where the console is configured by default, running at 9600 baud.

    The other USB connector is connected directly (with buffering) to the STM32, on pins A11/A12/B7 as USB_DM/USB_DP/USB_EN. I've largely ignored this connection to this point, as it was not responsive with the IDE -- I was able to connect with the other "USB" connection.

    So... If I could move the console over to the actual real native USB connection, and get awesome speed, that would be ideal. I suspect it's simply a matter of configuring those pins for a native USB connection, then directing the console there -- how do I do that?

    BTW sending another U$25 to keep supporting you guys... thanks for everything!

  • @dwallersv

    
    Serial**1** is the instance of the a Serial that is used... 
    
    

    Serial1.setup(115200); // notice: Serial1 (Serial # One)
    ```

    A9/A10 - USART1 (USART - Universal Synchronous/Asynchronous Receiver/Transmitter # 1) IS Serial1 - as per HW reference for HYSTM32_32.

  • As @allObjects says, you need the Serial1 like I posted, not Serial.

    If you're not getting any response from the on-board USB, I think it's probably just that you need to install the drivers mentioned in the Quick Reference?

  • Drivers was it... up and running, @Gordon, and blazingly fast! Coding is SOOOOOO much better!!

    Turns out I had installed the STM drivers weeks ago, but the COM port installation looked like it was hanging, so I killed it and stayed with the serial. Forgot about that until you mentioned the Quick Reference.

    So, plugged it in again, and waited it out this time. Took a long time, but eventually finished successfully and I was able to connect. Thanks!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

change console serial speed/baud?

Posted by Avatar for dwallersv @dwallersv

Actions