Skip to content

Commit

Permalink
fix(usart): tx / rx complete timing
Browse files Browse the repository at this point in the history
fix the calculation of cyclesPerChar, which is used to determine when a USART RX/TX operation is marked complete.
  • Loading branch information
urish committed Jul 15, 2021
1 parent bfc8ed9 commit e019ee8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/peripherals/usart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class AVRUSART {

private get cyclesPerChar() {
const symbolsPerChar = 1 + this.bitsPerChar + this.stopBits + (this.parityEnabled ? 1 : 0);
return (this.UBRR * this.multiplier + 1) * symbolsPerChar;
return (this.UBRR + 1) * this.multiplier * symbolsPerChar;
}

private get UBRR() {
Expand Down

0 comments on commit e019ee8

Please sign in to comment.