void UART4_Configuration(void)
{
USART_InitTypeDef USART_InitStructure;
USART_ClockInitTypeDef USART_ClockInitStructure;
USART_ClockInitStructure.USART_Clock = USART_Clock_Disable;
USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low;
USART_ClockInitStructure.USART_CPHA = USART_CPHA_2Edge;
USART_ClockInitStructure.USART_LastBit = USART_LastBit_Disable;
/* Configure the USART1 synchronous paramters */
USART_ClockInit(UART4, &USART_ClockInitStructure);
//波特率设置为115200
USART_InitStructure.USART_BaudRate = 115200; //38400;
//一帧数据的宽度设置为8bits
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
//在帧结尾传输1个停止位
USART_InitStructure.USART_StopBits = USART_StopBits_1;
//奇偶失能模式,无奇偶校验
USART_InitStructure.USART_Parity = USART_Parity_No ;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
/* Configure USART2 basic and asynchronous paramters */
USART_Init(UART4, &USART_InitStructure);
/*打开串口2的中断响应函数,接收中断*/
USART_ITConfig(UART4, USART_IT_RXNE, ENABLE);
/*打开串口2*/
USART_Cmd(UART4, ENABLE);
}
每次执行到USART_ClockInit(UART4, &USART_ClockInitStructure); 这条语句的时候,就跳到void assert_failed(uint8_t* file, uint32_t line)这句了,硬件错误吗?
|