AnsweredAssumed Answered

UART, Xbee and XCTU

Question asked by Mr.Cscn on Dec 10, 2015
Latest reply on Dec 11, 2015 by Clive One
so here the problem:
I'm trying to make a communication between two xbee module. The first is connect to stm32f10x (steval-mki121v1 eval board) and the second to the pc via usb.
i want to trasmits data from the first to the second using the uC UART and reads data using the xctu tool.
I'm having some trouble and i really don't understand where i'm wrong.
here the code to set the uart:

void UARTInit(void)
     USART_InitTypeDef USART_InitStructure;
     GPIO_InitTypeDef GPIO_InitStructure;
     //NVIC_InitTypeDef NVIC_InitStructure;

     RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO, ENABLE);

     /* Configure USART2 pins:  Rx and Tx ----------------------------*/
     GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_2 | GPIO_Pin_3;
     GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
     GPIO_Init(GPIOA, &GPIO_InitStructure);

     GPIO_PinRemapConfig(GPIO_Remap_USART2, ENABLE);

     GPIO_PinLockConfig(GPIOA, GPIO_Pin_2);
     GPIO_PinLockConfig(GPIOA, GPIO_Pin_3);

     USART_InitStructure.USART_BaudRate = 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_Tx | USART_Mode_Rx;
     USART_Init(USART2, &USART_InitStructure);

     /*NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;
     NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
     NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
     NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;               
     NVIC_Init(&NVIC_InitStructure);*/ need this?



the Tx pin is connect to DIN pin of xbee module and the Rx pin to the DOUT pin.
maybe some configuration to do with xctu?