Question
STM8S003F3 UART IRQ freezes mcu
Posted on November 01, 2016 at 18:44
hello everyone
been playing with that mcu for a while but I cant set up UART IRQ DR(data register) emptyIO 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 functionmy code:ISR(UART1_T_TXE_vector){ 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 enableInterrupts(); 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); x++; }anyone have an idea whats wrong? does it require some additional settings?