Skip to content

fix(cdc/ftdi): correct divisor selection in 1 MBaud to 2 MBaud range (IEC-534)#488

Open
spectrumjade wants to merge 1 commit intoespressif:masterfrom
spectrumjade:fix/ftdi-baudrate-divisor
Open

fix(cdc/ftdi): correct divisor selection in 1 MBaud to 2 MBaud range (IEC-534)#488
spectrumjade wants to merge 1 commit intoespressif:masterfrom
spectrumjade:fix/ftdi-baudrate-divisor

Conversation

@spectrumjade
Copy link
Copy Markdown

fix(cdc/ftdi): correct divisor selection in 1 MBaud to 2 MBaud range

Description

Previously, baud rates between above 1 MBaud were short-circuited to a special case divisor (either 0 or 1), but had the wrong reported realized rate. In the case of baudrate >= 1000000, the selected divisor was 1, which programs the chip at 2 MBaud (per AN232B-05), not 1 MBaud as claimed in the comment and set as baudrate_real. In addition, rates that the general divisor path could have handled (notably including 1.5 MBaud, which uses even divisor of 2) were being silently coerced to 2 MBaud.

This PR corrects the two special case divisors and allows baud rates below 2 MBaud to be handled by the general divisor path. This allows 1.5 MBaud to work properly.

Testing

Confirmed that an FT232R, which previously was not successfully able to function at a requested 1.5 MBaud, is now working properly at 1.5 MBaud.


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

@espressif-bot espressif-bot added the Status: Opened Issue is new label May 2, 2026
@github-actions github-actions Bot changed the title fix(cdc/ftdi): correct divisor selection in 1 MBaud to 2 MBaud range fix(cdc/ftdi): correct divisor selection in 1 MBaud to 2 MBaud range (IEC-534) May 2, 2026
@tore-espressif
Copy link
Copy Markdown
Collaborator

@spectrumjade thank you for the contribution!

I'll have to check why we did not enable 1.5Mbit. IIRC, the chips that I tested with did not support this baudrate. I'll double check so we can merge this PR, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Opened Issue is new

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants