Who can tell me the formula for the calculation?
I will write a small software for it.
I will publish the software here.
Thanks already
BRG number for the PIC32MZ
-
- Posts: 278
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 10, 2020 2:35 pm
- Location: Germany
- Has thanked: 37 times
- Been thanked: 17 times
-
- Matrix Staff
- Posts: 1952
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 510 times
- Been thanked: 698 times
Re: BRG number for the PIC32MZ
Hello,
We currently calculate the baud like this.
SlowMode = 0
BRGVAL = ((CLOCKSPEED / BAUD) / UART_INST_PER_CLK)
if (BRGVAL > 65535)
{
SlowMode = 1
BRGVAL = ((CLOCKSPEED / BAUD) / (UART_INST_PER_CLK * 4))
}
UART_INST_PER_CLK is typically 4 for the MX devices and 2 for the MZ devices at the very fastest but this seems to vary between devices and can be increased via a configuration setting.
We currently calculate the baud like this.
SlowMode = 0
BRGVAL = ((CLOCKSPEED / BAUD) / UART_INST_PER_CLK)
if (BRGVAL > 65535)
{
SlowMode = 1
BRGVAL = ((CLOCKSPEED / BAUD) / (UART_INST_PER_CLK * 4))
}
UART_INST_PER_CLK is typically 4 for the MX devices and 2 for the MZ devices at the very fastest but this seems to vary between devices and can be increased via a configuration setting.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 278
- Joined: Thu Dec 10, 2020 2:35 pm
- Location: Germany
- Has thanked: 37 times
- Been thanked: 17 times
Re: BRG number for the PIC32MZ
Hi Ben, I have something to try.
Please test it and publish it if it is ok.
Please test it and publish it if it is ok.
- Attachments
-
- compilation_brg.zip
- (3.44 MiB) Downloaded 231 times