cancel
Showing results for 
Search instead for 
Did you mean: 

STM8L discovery USART : can´t write to usart register!

prabhakar
Associate
Posted on July 04, 2012 at 11:08

i cant seem to be able to write in any of the usart registers. i use STVD with raisonance compiler.

eg. when i write

USART1->CR1 = 0x01;

i don´t see any change in CR1 perpheral registers (that i view in STVD window). This works with the other registers.I also remap the usart clk ans tx pin to port A.

 Do i have to inlude some other files or do some more remapping etc. to be able to write in the USART register? 
3 REPLIES 3
Posted on August 07, 2012 at 15:37

Like enabling the USART clock?

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on June 20, 2017 at 08:58

I am getting some what of a similar problem. Whatever value I give to the USART_DR register it always takes the value 0xff though the other registers work fine. Even if I give char value to the USART_DR it still takes value 0xff.

My initialization code is

void usartinit(void) //usart initialisation (115200 , 8bit , no parity , 1 stop bit

{

char X;

PC_DDR = 0x10;

PC_CR1 = 0x10;

X = USART1_SR;

X = USART1_DR;

USART1_CR1 = 0x00;

USART1_CR2 = 0x0C;

USART1_CR3 = 0x0f;

USART1_CR4 = 0x03;

USART1_BRR2 = 0x0A;

USART1_BRR1 = 0x08;

}
Shawn O'Neil
Associate
Posted on May 17, 2018 at 00:15

What was your outcome. I am seeing the same issue. I also saw this with TIM1 registers. I switched to using TIM3 and that was fine.

Thank you,

Shawn