初中生
最后登录1970-1-1
在线时间 小时
注册时间2015-4-28
|
火哥你好:
我将GPS_Decode_USART程序中串口2相关部分改为串口3,现在无任何反应,想问下还需要更改什么设置啊!
void USART3_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
/* config USART3 clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
/* USART3 GPIO config */
/* Configure USART3 Tx (PB.10) as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* Configure USART3 Rx (PB.11) as input floating */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/* USART3 mode config */
USART_InitStructure.USART_BaudRate = 9600; //GPSÄ£¿éĬèÏê1óÃ2¨ìØÂê£o9600
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(USART3, &USART_InitStructure);
USART_ITConfig(USART3, USART_IT_RXNE, ENABLE); //
USART_Cmd(USART3, ENABLE);
}
#ifndef __GPS_CONFIG_H
#define __GPS_CONFIG_H
#include "stm32f10x.h"
#include "nmea/nmea.h"
/* ÅäÖÃ */
//#define __GPS_DEBUG //¶¨òåÕa¸öo꣬Ôúnmea½aÂëê±»áêä3öμ÷êÔDÅÏ¢
//#define __GPS_LOG_FILE //¶¨òåÕa¸öo꣬¶ÔSD¿¨éÏμÄgpslog.txtÎļt½øDD½aÂ룻2»¶¨òåμÄ»°ê1óÃ′®¿ú2½óêÕGPSDÅÏ¢½aÂë
/* GPS½ó¿úÅäÖà ê1óÃ2»í¬μÄ′®¿úê±£¬òaDT¸Ä¶Ôó|μĽó¿ú */
#define USART3_DR_Base (0x40004800+0x04) // ′®¿ú2μÄêy¾Y¼Ä′æÆ÷μØÖ·
#define GPS_DATA_ADDR USART3_DR_Base //GPSê1óÃμÄ′®¿úμÄêy¾Y¼Ä′æÆ÷μØÖ·
#define GPS_RBUFF_SIZE 512 //′®¿ú½óêÕ»o3åÇø′óD¡
#define HALF_GPS_RBUFF_SIZE (GPS_RBUFF_SIZE/2) //′®¿ú½óêÕ»o3åÇøò»°ë
/* íaéè */
#define GPS_USART USART3
#define GPS_DMA DMA1
#define GPS_DMA_CLK RCC_AHBPeriph_DMA1
#define GPS_DMA_CHANNEL DMA1_Channel6
#define GPS_DMA_IRQn DMA1_Channel6_IRQn //GPSÖD¶ÏÔ′
|
|