AnsweredAssumed Answered

STM32F10x UART tx hyperterminal

Question asked by hogenkamp.nick on Mar 24, 2015
Latest reply on Mar 25, 2015 by hogenkamp.nick
Hello,

I want to sent some characters to a hyperterminal program. But my program wont work..
I dont receive any characters in my hyperterminal. 
I am using the STM32-P107 development kit. The controller on it is the STM32F107VC
I really need help here. I hope someone here see what i am doing wrong. I would really appreciate it. 

This is my code:





/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
#include "stm32f10x_gpio.h"
#include "stm32f10x_rcc.h"
#include "stm32f10x_usart.h"
#include <stdio.h>




void USART_Print_Nick(void)
{




       int i;


//**************************************RCC Configuration*************************************\
       /* Enable GPIO clock */
       RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO | RCC_APB2Periph_GPIOC, ENABLE);


       /* Enable UART clock */
       RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);






//**************************************GPIO Configuration*************************************\


       GPIO_InitTypeDef GPIO_InitStructure;


       /* Configure USART Tx as alternate function push-pull */
       GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;                           // PA.02 USART1.TX
       GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
       GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
       GPIO_Init(GPIOA, &GPIO_InitStructure);


       /* Configure USART Rx as input floating */
       GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;                          // PA.03 USART1.RX
       GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
       GPIO_Init(GPIOA, &GPIO_InitStructure);


       //LED TOGGLE.. initialized                                             // PA.08 = output port for LED
       GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
       GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
       GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
       GPIO_Init(GPIOC, &GPIO_InitStructure);




//**************************************USART Configuration*************************************\


       USART_InitTypeDef USART_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 configuration */
       USART_Init(USART2, &USART_InitStructure);


       /* Enable the USART2 */
       USART_Cmd(USART2, ENABLE);




//******************************************Program**********************************************\


       while(1)
         {




              // 1010.1010
              USART_SendData(USART2, 0xAA);


              //LED toggle
              GPIO_WriteBit(GPIOC, GPIO_Pin_8, 1);
             for(i=0;i<0x100000;i++);


              GPIO_WriteBit(GPIOC, GPIO_Pin_8, 0);
             for(i=0;i<0x100000;i++);


         }
}




 

Outcomes