su-409464 发表于 2016-7-7 14:17:03

使用STMCubeMx 生成Uart 工程后串口没有输出

硬件‘ :STM32L073RZnecleo 64
使用STMCubeMx 生成简单工程 添加了串口外设。
int main(void)
{
HAL_Init();


SystemClock_Config();


MX_GPIO_Init();
MX_USART2_UART_Init();

HAL_UART_Transmit_IT(&huart2, (uint8_t *)aTxStartMessage, sizeof(aTxStartMessage));
HAL_UART_Receive_IT(&huart2, (uint8_t *)aRxBuffer, 10);

while (1)
{
    printf("\n\r welcome to www.waveshere.com !!!\n\r");
    HAL_Delay(1000);
}回调函数
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(huart);

/* NOTE : This function should not be modified, when the callback is needed,
            the HAL_UART_RxCpltCallback can be implemented in the user file
   */
    HAL_UART_Transmit(&huart2, (uint8_t *)aRxBuffer, 10,0xFFFF);
}
但是程序编译之后 有一个warning,
Thu Jul 07, 2016 14:04:54: Skipping flash loading pass because there is no data in the designated range: 0x8080000-0x80817FF.
忽略之后 继续运行。

串口2 一点反应都没有!!!

请问一下 具体哪里搞错了???



su-409464 发表于 2016-7-8 08:35:33

最后找到答案了!

nucleo 的板子 连接上把 usart2 接到了 STMF103 那边去了。

使用了STMLINK2-1的虚拟串口!

所以一开始我直接接 板子右下角上的 排针一直没有输出! 应为实际上板子已经把串口引导虚拟串口上去。。。


zero99 发表于 2016-7-10 11:33:31

谢谢分享
页: [1]
查看完整版本: 使用STMCubeMx 生成Uart 工程后串口没有输出