Closed
Description
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.