AnsweredAssumed Answered

STM8S003F3 UART IRQ freezes mcu

Question asked by kowalski.jas on Nov 1, 2016
Latest reply on May 10, 2017 by jackson ward
hello everyone

been playing with that mcu for a while but I cant set up UART IRQ DR(data register) empty
IO pins interrupts work as expected but after setting TIEN in CR2 function enableInterrupts() freezes whole chip and ISR is never hit it just hangs on that function

my code:

  PD_ODR ^= 1<<3;

int main( void )
  UART1_CR1_.M = 1;//9 bit data inc parity bit
  UART1_CR3 |= 0x20;//2 stop bits
    UART1_BRR2 = (u8)0x02;//baud setting 9600 at 16MHz 
  UART1_BRR1 = (u8)0x68;
    UART1_CR1_.PCEN = 1;//parity check enable
    UART1_CR1_.PS = 0;//even parity
  UART1_CR2_.TEN = 1;//TX enable
  //UART1_CR2_.TIEN = 1;//DR empty IRQ enable
  UART1_CR2_.REN = 1;//RX enable
  u8 x = 0;
  u8 buf[10] = { 65,66,67,68,69,70,71,72,73,74 };
  while (x<10)
  UART1_DR = buf[x];   
  while (UART1_SR_.TXE == 0);  

anyone have an idea whats wrong? does it require some additional settings?