cancel
Showing results for 
Search instead for 
Did you mean: 

STM8L Discovery USART

prabhakar
Associate
Posted on July 03, 2012 at 19:59

i want to transmit using the stm8l152 on the stm8l discovery board. For that i have used sys config registers to remap the clk and the tx pin to the Port A. I use stvd and raisonance compiler. i cannot understand why i cannot write to any usart register even though i can write in the other registers. 

eg.   if i write into the CR1 register of the USART of the stm8 

USART1->CR1 = 0x10 ;

After this when i check the value of the peripheral register CR1 of the usart using stvd the value is always 0x00

Even when using any other functions like usart init , usart clock init etc. the value of the usart registers does not change. 

Is there something files or initializations i should specifically do. ? should the gpio pins be initialized to a certain state or should some remapping of registers be done?

 

any help will be appreciated. thanks 

#uart-clock-enable
2 REPLIES 2
Stm32User
Associate II
Posted on July 06, 2012 at 10:43

On the STM8L parts the clock to the peripherals is OFF by default.  You need to enable the uart clock before it will work.

CLK_PeripheralClockConfig(CLK_Peripheral_USART1,ENABLE);

hiproz
Associate
Posted on January 19, 2014 at 21:03

the default usart is in pa or pc of 20 pin packet?