Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UARTBR - wrong baud rate calculation formula [solved]
#1
Hi,
As I see in PIC24FJ128GA110 datasheet (page 182) the UART baud rate with "BRGH = 1" calculated by following formula:
UARTBR = (FCY/(4*Baud Rate) -1)

but in BL code I see following:
.ifdef USE_BRGH
.equ UARTBR, ( (((FCY / BAUDRATE) / 2) - 1) / 2 )
.endif

The datasheet formula checked in my applications and work fine on 115200 bps baud rate.

So it's looking like there must be:
.equ UARTBR, ((FCY / (4*BAUDRATE)) - 1)

Is it try?
Regards.
Yuters
Reply
#2
Hi,
My version does rounding to achieve better results.
Try it yourself to see how it works.

Thanks,
Mikael
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)