[PATCH] TMS570 console driver, SCI frame error (baudrate calculation error)
Joel Sherrill
joel at rtems.org
Tue Jul 11 22:06:05 UTC 2023
First, the patch commit message needs to reference the ticket (#4903).
It would be nice to have Pavel's feedback but the submitter of
https://devel.rtems.org/ticket/4903
provided the fix but not in patch format. What do you think we should do
beyond trust the
submitter of the ticket?
bsps/arm/tms570/console/tms570-sci.c: tms570_sci_set_attributes()
/* Apply baudrate to the hardware */
baudrate *= 2 * 16;
bauddiv = (BSP_PLL_OUT_CLOCK + baudrate / 2) / baudrate;
ctx->regs->BRS = bauddiv? bauddiv - 1: 0;
replacing with 2 fixed frame error
ctx->regs->BRS = bauddiv? bauddiv - 2: 0;
there is issue in baudrate calculation
On Tue, Jul 11, 2023 at 12:52 PM Gedare Bloom <gedare at rtems.org> wrote:
> Hi Zack,
>
> Thanks for the patch. Someone should probably test it, or identify in
> the documentation why this calculation was off-by-1. Pavel, any clues?
>
> Gedare
>
> On Sun, Jul 9, 2023 at 10:09 PM zack <zakthertemsdev at gmail.com> wrote:
> >
> > Fixes #4903
> > diff --git a/bsps/arm/tms570/console/tms570-sci.c
> b/bsps/arm/tms570/console/tms570-sci.c
> > index 768770a4c8..59a0b7e6f1 100644
> > --- a/bsps/arm/tms570/console/tms570-sci.c
> > +++ b/bsps/arm/tms570/console/tms570-sci.c
> > @@ -311,7 +311,7 @@ bool tms570_sci_set_attributes(
> > /* Apply baudrate to the hardware */
> > baudrate *= 2 * 16;
> > bauddiv = (BSP_PLL_OUT_CLOCK + baudrate / 2) / baudrate;
> > - ctx->regs->BRS = bauddiv? bauddiv - 1: 0;
> > + ctx->regs->BRS = bauddiv? bauddiv - 2: 0;
> >
> > ctx->regs->GCR1 |= TMS570_SCI_GCR1_SWnRST | TMS570_SCI_GCR1_TXENA |
> > TMS570_SCI_GCR1_RXENA;
> > --
> > 2.34.1
> >
> > _______________________________________________
> > devel mailing list
> > devel at rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20230711/d70b34f1/attachment.htm>
More information about the devel
mailing list