1、波特率计算方法
在UART和SPI两种模式下,波特率都是由一个CC2430内在的波特率发生器产生,UxBAUD.BAUD_M[7:0]和UxGCR.BAUD_E[4:0]寄存器分别记录了转换的尾数和指数,公式如下:
Buadrate=(256+Baud_M)*(2的Baud_E次方)*F/(2的28次方)
其中F为系统的时钟频率=16MHz或者32MHz。The maximum baud rate for UART mode is F/16 when BAUD_E is 16 and BAUD_M is 0, and where F is the system clock requency. The maximum baud rate for SPI mode and thus SCK frequency, is F/2 when BAUD_E is 19 and BAUD_M is 0. Setting higher baud rates than this will give erroneous results。
Baud rate (bps) UxBAUD.BAUD_M UxGCR.BAUD_E Error (%)
2400 59 6 0.14
4800 59 7 0.14
9600 59 8 0.14
14400 216 8 0.03
19200 59 9 0.14
28800 216 9 0.03
38400 59 10 0.14
57600 216 10 0.03
76800 59 11 0.14
115200 216 11 0.03
230400 216 12 0.03
Commonly used baud rate settings for 32 MHz system clock