heyjourney 发表于 2012-3-7 22:50:13

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

首先我利用串口调试工具将开发板子和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
*********************************************************************************************************/
 

发表于 2012-3-8 09:44:32

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

注意一下,RX和TX需要交叉。

heyjourney 发表于 2012-3-8 09:57:03

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

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

火雷达 发表于 2012-3-8 22:32:44

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

就是RX--接TX,TX接RX,一个接,一个发
页: [1]
查看完整版本: 求教stm32f103ze开发板usart与串口wifi模块通信问题