AnsweredAssumed Answered

STM32F103Z USART strange output

Question asked by su.sam.001 on Nov 12, 2013
Latest reply on Nov 13, 2013 by Clive One
Hello,

I'm using a SM3210e-Eval board  with a STM32F103Z processor from ARM and I'm a newbie . I dont really get why but if I send I getting a different value on my Terminal (hterm)

Example:
I'm sending 0x49 but get 8698 (Hex) 
I'm sending 'A' but get   FE06 (Hex)  
I'm sending '0' but get  F800 (Hex) 

I'm not sure but do I need to change some clockspeed in the SystemInit() ?
But which one and how much ? I'm really lost....trying since 2 days solve this problem...


USART_InitTypeDef USART_InitStructure; 
 
 
void main(void) 
{ 
SystemInit(); 
Init(); 
Config_ADC(); 
Config_Usart(); 
... 
 
while(1) 
{ 
  USART_SendData(USART1,0x49); ///* Loop until the end of transmission */while(USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET) 
  { 
  } 
} 
} 
 
void Config_Usart() 
{ 
   
  //enable bus clocks 
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO, ENABLE); 
 
  /* Configure USART2 Tx as alternate function push-pull */ 
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; 
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; 
  GPIO_Init(GPIOA, &GPIO_InitStructure); 
   
  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_Rx | USART_Mode_Tx; 
  /* Configurating and enabling USART1 */  
  USART_Init(USART1, &USART_InitStructure);  
 
 
  USART_Cmd(USART1, ENABLE); 
}

Outcomes