电子工程师技术服务社区
- 社区首页
- 下载
- stsw-link007.zip
资料描述
本次f469搭载的仿真器版本为st-link v2.1,最重要的一个特点是集成了虚拟串口。
大致使用方式是,仿真器通过连接mcu的串口,可以作为串口转usb模块直接与pc等通讯。
以下,将进行关于usart以及虚拟串口的实验。
1.安装stlink v2.1驱动
使用虚拟串口功能,需要进行驱动升级。
st官网提供了驱动,这里我下载下来提供给大家。
2.选定管脚
打开mb1189原理图说明,可以看到仿真器的虚拟串口对应的管脚是pb10与pb11。
3.新建工程并初始化usart3
pb10与pb11对应的是串口3,在cube中进行初始化。
设置波特率为115200,其余按照默认设置。
4.生成所需工程
5.加入用户代码
在while 1中,加入几行发送程序。
uint8_t send = "hello";
/* user code end 0 */
int main(void)
{
/* user code begin 1 */
/* user code end 1 */
/* mcu configuration----------------------------------------------------------*/
/* reset of all peripherals, initializes the flash interface and the systick. */
hal_init();
/* configure the system clock */
systemclock_config();
/* initialize all configured peripherals */
mx_gpio_init();
mx_usart3_uart_init();
/* user code begin 2 */
/* user code end 2 */
/* infinite loop */
/* user code begin while */
while (1)
{
/* user code end whi