下午用nucleo的stm32f413开发板做串口中断接收时发现的一个小问题,在手册里曾经有一段关于st-link的串口描述,当时没有看懂,今天做实验才深有体会。
原文是这样的:The USART3 interface available on PD8 and PD9 of the STM32 can be connected either to ST-LINK or to ST morpho connector. The choice is changed by setting the related solder bridges. By default the USART3 communication between the target STM32 and the STLINK is enabled, to support the virtual COM port for the mbed (SB5 and SB6 ON).
大体意思是串口可以用来连接st-link与stm32单片机。
然后用串口3打印没问题,但在用中断接收并将接收到的字符返回到串口时就卡死了,是因为我当时还用st-link连接了电脑,这时候串口3默认到st-link上,导致程序不能正常运行,只要拔掉st-link就可以正常了。