cancel
Showing results for 
Search instead for 
Did you mean: 

STM32f100R8-USART1 Configuration

dharani
Associate II
Posted on July 24, 2013 at 09:24

Hi All,

          Basically i want to configure the USART1 in the STM32f100R8 uC. The following code i have written for configureing USART1.

 //UART1 initialization

RCC->APB2ENR |= RCC_APB2ENR_AFIOEN + RCC_APB2ENR_IOPAEN +RCC_APB2ENR_USART1EN; 

RCC-> AHBENR |= RCC_AHBENR_SRAMEN;

GPIOA->CRH |= GPIO_CRH_CNF9_1 + GPIO_CRH_MODE9_0 ; 

GPIOA->CRH |= GPIO_CRH_CNF10_0 + GPIO_CRH_MODE10_0 ; 

USART1->BRR = 0x0052;

USART1->CR1 |= USART_CR1_UE + USART_CR1_TE + USART_CR1_RE + USART_CR1_RXNEIE; 

USART1->DR ='@';

But, when i try to run this code it's not transmitting any data. And i am not seeing any data in USART1 DR register.

#stm32f100r8-usart1
5 REPLIES 5
crt2
Associate II
Posted on July 24, 2013 at 10:42

Why dont you just take something from examples? This style of writing code is ''2 die 4''.

Posted on July 24, 2013 at 18:59

What clocks and baud rate are you working with here?

If you send a continuous stream of characters can you see them on a scope, does the bit timing appear correct?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dharani
Associate II
Posted on July 26, 2013 at 08:10

System clock is 8MHZ,

And USART baud rate is 9600kbps.

I am trying to send only one byte. When i am writing data to the DR (data register). it's not getting updated on DR register in debugging mode.

dharani
Associate II
Posted on July 26, 2013 at 08:17

sorry, its 9600bps not 9600kbps

Posted on July 26, 2013 at 08:34

The debugger can't look behind the curtains to see what is in the register, don't assume it can display a useful value.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..