关于ST CUBE函数库的使用,
我们都知道ST公司以后更新库函数,都会使用STM32cube固件库了,但是这个库的使用貌似会的人并不多,今天我调试串口的时候就发现了以下这个现象,USART接口初始化以下就可以发送了,但是初始化中为什么没有管脚的初始化呢,很是纳闷void UART_Config(void)
{
/*##-1- Configure the UART peripheral ######################################*/
/* Put the USART peripheral in the Asynchronous mode (UART Mode) */
/* UART1 configured as follow:
- Word Length = 8 Bits
- Stop Bit = One Stop bit
- Parity = NONE parity
- BaudRate = 115200 baud
- Hardware flow control disabled (RTS and CTS signals) */
huart1.Instance = USART1;
huart1.Init.BaudRate = 9600;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
huart1.Init.StopBits = UART_STOPBITS_1;
huart1.Init.Parity = UART_PARITY_NONE;
huart1.Init.Mode = UART_MODE_TX_RX;
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
HAL_UART_Init(&huart1);
}
接着使用HAL_UART_Transmit(huart,&dat,1,1000);发送函数可以正常发送数据,
不明白为什么,有知道的吗,还有哪里有讲解新库的使用方法呢。
RE:关于ST CUBE函数库的使用,
huart1.Instance = USART1,USART1这个宏HAL_UART_Init(&huart1)里的 HAL_UART_MspInit(huart),楼主进去看看
页:
[1]