chg: add fractional for 921600, 1382400 baudrate

This commit is contained in:
iceman1001 2019-05-18 21:40:45 +02:00
parent d983f49652
commit ec796f4d81
2 changed files with 10 additions and 1 deletions

View file

@ -236,7 +236,13 @@ void usart_init(uint32_t baudrate, uint8_t parity) {
// OVER = 1, -yes we are oversampling
// baudrate == selected clock/8/CD --> this is ours
//
pUS1->US_BRGR = 48000000 / (usart_baudrate << 3);
uint32_t fractional = 0;
if ( baudrate == 921600 )
fractional = 4;
else if ( baudrate == 1382400 )
fractional = 2;
uint32_t brgr = 48000000 / (usart_baudrate << 3);
pUS1->US_BRGR = (fractional << 16) | brgr;
// Write the Timeguard Register
pUS1->US_TTGR = 0;

View file

@ -8,6 +8,9 @@
#define USART_BAUD_RATE 115200
//#define USART_BAUD_RATE 230400
//#define USART_BAUD_RATE 460800
//#define USART_BAUD_RATE 921600
//#define USART_BAUD_RATE 1382400
extern uint32_t usart_baudrate;
#define USART_PARITY 'N'
extern uint8_t usart_parity;