AnsweredAssumed Answered

STM32f4 rs232 IAR IDE

Question asked by achour.wissem on Jun 2, 2013
Latest reply on Jun 11, 2013 by achour.wissem
hello :)
i had a problem  when i send a character or receive a character , i always get a wrong character like "-" or a heart ...
ps: i'm using rs232 -> USB converter
here is my code:


#include "stm32f4xx.h"

void main()
{
 //UART4 initialization
RCC->APB1ENR |= 0x00080000; // Enable clock for UART4
RCC->AHB1ENR |= 0x00000004; // Enable clock for GPIOC
GPIOC->MODER |= 0x00a00000; // PC10, PC11 => AF mode
GPIOC->AFR[1] |= 0x00008800; // select AF8 (UART4,5,6) for PA10, PA11
UART4->BRR = 0x1120; // 9600 baud
UART4->CR1 |= 0x200c; // Enable UART for TX, RX
UART4->CR1 |= 0x0020; // Enable RX interrupt


while(1){
  if (UART4->SR & 0x0080) {
   UART4->DR='a';
   for (int i=0; i<10000000; i++) {};
  }
}
}

please any help! :(

Outcomes