你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

查看: 5836|回复: 3

求教stm32f103ze开发板usart与串口wifi模块通信问题

[复制链接]

1

主题

1

回帖

0

蝴蝶豆

新手上路

最后登录
1970-1-1
发表于 2012-3-7 22:50:13 | 显示全部楼层 |阅读模式
首先我利用串口调试工具将开发板子和wifi模块分别和电脑相连,并且用串口调试工具,能够实现开饭板子和wifi模块的数据传送。
但是,我用开发板子,和wifi模块用串口线相连,arm板子是接收不到数据的。
我检查了下,能保证串口线连接正确,wifi模块能够和发送端无线相连上(因为之前都是和电脑串口相连测试过的)
我就找不到问题所在,求大侠解决, 这个问题很急,希望能帮忙解决,先谢谢了。
 
 
附上原main()原代码:
/****************************************Copyright (c)****************************************************
**                                      
**                                 http://www.powermcu.com
**
**--------------File Info---------------------------------------------------------------------------------
** File name:               main.c
** Descriptions:            The USART application function
**
**--------------------------------------------------------------------------------------------------------
** Created by:              AVRman
** Created date:            2010-10-30
** Version:                 v1.0
** Descriptions:            The original version
**
**--------------------------------------------------------------------------------------------------------
** Modified by:             
** Modified date:           
** Version:                 
** Descriptions:            
**
*********************************************************************************************************/
 
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
#include
 
#ifdef __GNUC__
  /* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf
     set to 'Yes') calls __io_putchar() */
  #define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
  #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif /* __GNUC__ */
 
/* Private function prototypes -----------------------------------------------*/
void USART_Configuration(void);
 
/*******************************************************************************
* Function Name  : main
* Description    : Main program
* Input          : None
* Output         : None
* Return         : None
* Attention                 : None
*******************************************************************************/
int main(void)
{
        USART_Configuration();
    printf("*****************************************************************\r\n");
    printf("*                                                               *\r\n");
    printf("*  Thank you for using HY-RedBull V3.0 Development Board ! ^_^  *\r\n");
    printf("*                                                               *\r\n");
    printf("*****************************************************************\r\n");
           printf("\r\nPlease input any word :\r\n");
    /* Infinite loop */
    while (1){
                /* Loop until RXNE = 1 */
        while (USART_GetFlagStatus(USART1, USART_FLAG_RXNE) == RESET);
                USART_SendData(USART1,USART_ReceiveData(USART1));
    }
}
 
 
/*******************************************************************************
* Function Name  : USART_Configuration
* Description    : Configure USART1 
* Input          : None
* Output         : None
* Return         : None
* Attention                 : None
*******************************************************************************/
void USART_Configuration(void)

  GPIO_InitTypeDef GPIO_InitStructure;
  USART_InitTypeDef USART_InitStructure; 
 
  RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_USART1,ENABLE);
  /*
  *  USART1_TX -> PA9 , USART1_RX ->        PA10
  */                               
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;                 
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; 
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 
  GPIO_Init(GPIOA, &GPIO_InitStructure);                   
 
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;                
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;  
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 
  GPIO_Init(GPIOA, &GPIO_InitStructure);
 
  USART_InitStructure.USART_BaudRate = 115200;
  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); 
  USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
  USART_ITConfig(USART1, USART_IT_TXE, ENABLE);
  USART_ClearFlag(USART1,USART_FLAG_TC);
  USART_Cmd(USART1, ENABLE);
}
 
/**
  * @brief  Retargets the C library printf function to the USART.
  * @param  None
  * @retval None
  */
PUTCHAR_PROTOTYPE
{
  /* Place your implementation of fputc here */
  /* e.g. write a character to the USART */
  USART_SendData(USART1, (uint8_t) ch);
 
  /* Loop until the end of transmission */
  while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET)
  {}
 
  return ch;
}
 
#ifdef  USE_FULL_ASSERT
 
/**
  * @brief  Reports the name of the source file and the source line number
  *   where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t* file, uint32_t line)

  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
 
  /* Infinite loop */
  while (1)
  {
  }
}
#endif
 
/*********************************************************************************************************
      END FILE
*********************************************************************************************************/
 
<
回复

使用道具 举报

134

主题

4489

回帖

239

蝴蝶豆

版主

最后登录
2020-12-9
发表于 2012-3-8 09:44:32 | 显示全部楼层

RE:求教stm32f103ze开发板usart与串口wifi模块通信问题

注意一下,RX和TX需要交叉。
回复 支持 反对

使用道具 举报

1

主题

1

回帖

0

蝴蝶豆

新手上路

最后登录
1970-1-1
 楼主| 发表于 2012-3-8 09:57:03 | 显示全部楼层

回复:求教stm32f103ze开发板usart与串口wifi模块通信问题

回复第 2 楼 于2012-03-08 01:44:32发表:
注意一下,RX和TX需要交叉。
交叉?具体是什么意思,不是很明白
 
回复 支持 反对

使用道具 举报

3

主题

185

回帖

0

蝴蝶豆

新手上路

最后登录
1970-1-1
发表于 2012-3-8 22:32:44 | 显示全部楼层

回复:求教stm32f103ze开发板usart与串口wifi模块通信问题

就是RX--接TX,TX接RX,一个接,一个发
回复 支持 反对

使用道具 举报

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
st-img 微信公众号
st-img 手机版