Skip to content

Long delay for Serial1.begin() / missing updateBaudRate() #2907

@gicking

Description

@gicking

I have a library which provides LIN communication across a variety of architectures and serial interfaces. To generate LIN BREAK signal, I temporarily reduce the baudrate, send 0x00 and revert to the original baudrate.

However, when porting to Nucleo-STM32L432KC I found that changing the baudrate via Serial1.begin() and subsequent Serial1.write() adds a pause of ~1B before BREAK, and between BREAK and SYNC, which causes LIN slaves to time-out. Note that this is not due to Serial1.begin() but really an additional latency between begin() and write()which seems to be ~1B at the respective baudrate (see screenshots)

Can you please check what causes this long latency and improve it? Alternatively add a new method updateBaudRate(), similar to ESP32 (see here) with smaller latency? Attached please find a small sketch and screenshots to show what I mean.

Reproduce
Run this sketch and measure TxD and testpin with a logic analyzer
STM32_switch_baudrate.zip

Expected behavior
Time to switch baudrate and subsequent byte is very short on other platforms.

Screenshots
Image

Image

Desktop:

  • OS: Linux / Ubuntu
  • STM32 core v2.12.0
  • Arduino IDE version: 2.3.7
  • STM32 core version: 2.12.0

Board:

  • Name: Nucleo-STM32L432KC

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions