|
ARM串口问题!!请问怎么样才能把波特率设成19200 啊??还有怎么开中断多谢
[复制链接]
void init_serial (void) {
int i;
/* Configure UART2 for 115200 baud */
RCC->APB2ENR |= 1 << 0; /* Enable AFIO clock */
RCC->APB2ENR |= 1 << 5; /* Enable GPIOD clock */
AFIO->MAPR |= 0x00000008; /* Configure used Pins */
GPIOD->CRL &= 0xF00FFFFF;
GPIOD->CRL |= 0x04B00000;
RCC->APB1ENR |= 0x00020000; /* Enable USART#2 clock */
USART2->BRR = 0x0135; /* Configure 115200 baud, */
USART2->CR3 = 0x0000; /* 8 bit, 1 stop bit, */
USART2->CR2 = 0x0000; /* no parity */
for (i = 0; i < 0x1000; i++) __NOP();/* avoid unwanted output */
USART2->CR1 = 0x200C;
}
ARM串口问题!!请问怎么样才能把波特率设成19200 啊??还有怎么开中断多谢
[ 本帖最后由 heartcn 于 2013-8-13 19:04 编辑 ]
|
|