Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

300 Baud Error in HardwaeSerial #2366

Closed
Closed
Labels
Component: FirmwareLimited to the contents of the firmwares folder in the core packages Type: DuplicateAnother item already exists for this topic
@norposie

Description

I'm very new in C Language and working with Arduino.
Making a Projekt using 300 Baud i got Mismatch and therefore i had a Look on the Code.
Most Programmers on AVR Microcontrollers and i also use the alternative Formula to calculate the Register Value wich is (F_CPU/8/Baud -1) / 2 and set the U2X bit 1 or UCSRA=2
this is for 300 Baud 3332 wich is doubled by U2X =1 so you get 6664.
In HardwareSerial Routine the first Calculation is F_CPU/4.......this calculates the Registervalue direct and puts it with U2X=0 in the Register ,so the Baud is not doubled. ( for 300 Baud = 6666 )
While 6666 is greater than 4095 the Register will overflow.
To solve this Prob the second Calculation F_CPU/8 calculates the right value but with UCSRA=0 it will not be doubled and is therefore wrong. UCSRA must be 2 to double it !

Hope there is anyone here who can solve this in next package.
Is there any way to change these registers fromin the Arduino Code ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: FirmwareLimited to the contents of the firmwares folder in the core packages Type: DuplicateAnother item already exists for this topic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /