cancel
Showing results for 
Search instead for 
Did you mean: 

STM32f4 rs232 IAR IDE

achourwissem
Associate II
Posted on June 02, 2013 at 13:34

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:

&sharpinclude ''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! :(

#too-vague
20 REPLIES 20
achourwissem
Associate II
Posted on June 11, 2013 at 18:26

ah sorry i dont know the reference exatly , it's not mentionned but it's normal one