为何HAL_UART_Transmit可发送,改成HAL_UART_Transmit_IT就不行了
cube配置的
STM32f407系统
其他代码均一样
while(HAL_OK != HAL_UART_Transmit_IT(DEFAULT_UART, (uint8_t*)UartTxBuffer, index)); //不行
while(HAL_OK != HAL_UART_Transmit(DEFAULT_UART, (uint8_t*)UartTxBuffer, index, 0xFFFF)); //可以
----
搞定,见21楼
板子是某stm32的开发板,因为是别人给我的,恕我直言,真不知道是什么型号,只知道是F407
代码如下,自写xprintf:
int xprintf(const char *format, ...)
{
unsigned int index = 0;
int k;
va_list marker;
/* the first parameter location is after passing format
*/
va_start(marker, format);
/* wait until Tx Available
translate into string - vxprintf
*/
UartCheckTxAvailable();
k = vxprintf(UartTxBuffer, &index, format, marker);
va_end(marker);
/* put out to uart
*/
// while(HAL_OK != HAL_UART_Transmit_IT(DEFAULT_UART, (uint8_t*)UartTxBuffer, index));
while(HAL_OK != HAL_UART_Transmit(DEFAULT_UART, (uint8_t*)UartTxBuffer, index, 0xFFFF));
UartSetTxAvailable();
return k;
}
一周热门 更多>