Skip to content

Serial Port baud rate divider is set incorrectly, fails to generate low baud rates correctly #84

Closed
@TomKeddie

Description

@TomKeddie

From SERCOM::initUART

    // Asynchronous arithmetic mode
    // 65535 * ( 1 - sampleRateValue * baudrate / SystemCoreClock);
    // 65535 - 65535 * (sampleRateValue * baudrate / SystemCoreClock));
    sercom->USART.BAUD.reg = 65535.0f * ( 1.0f - (float)(sampleRateValue) * (float)(baudrate) / (float)(SystemCoreClock));

As per Table 24-2 of Atmel-42181G–SAM-D21_Datasheet–09/2015, constant in formula should be 65536, not 65535. Also no rounding is performed to take float to closest integer.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions