野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12415|回复: 1

stm32如何用usart3实现非标准速率(速率为31.25kbpd)的uart协议?

[复制链接]
发表于 2015-2-24 21:30:56 | 显示全部楼层 |阅读模式
我实现过115200是可以的,但是实现31.25k时,收到的数据是乱码?
各位大侠帮着看看,多谢了~~

void USART_Configuration(void)                                                      
{
    //USART1  
    USART_InitTypeDef USART_InitStructure;                                          
    USART_InitStructure.USART_BaudRate = 115200;//9600;                             
    USART_InitStructure.USART_WordLength = USART_WordLength_8b;                     
    USART_InitStructure.USART_StopBits = USART_StopBits_1;                          
    USART_InitStructure.USART_Parity = USART_Parity_No;                             
    USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
    USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;                 
    USART_Init(USART1, &USART_InitStructure);                                       

回复

使用道具 举报

发表于 2015-2-26 09:35:52 | 显示全部楼层
使用非推荐的波特率,可能会因分频产生误差导致错误
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-9-20 15:43 , Processed in 0.045066 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表