Question
STM32F107 Interrupt crash
Posted on March 30, 2017 at 17:44
Hi to all,
I have a problem about interrupt, expecially USART interrupt.I use USART1 to interface my boarf to computer (FT232), but often my routine crashes.Here is the code:uint16_t iocnt = 0;extern 'C' void USART1_IRQHandler() // Default print{ uint8_t c; c = USART1->DR; if(iocnt < MAXBUF - 10) { if(c != '\n') { iobuf[iocnt++] = c; iobuf[iocnt] = 0; } else { USART1->CR1 &= ~USART_CR1_RXNEIE; //Disable RXNE interrupt iobuf[iocnt] = 0; iocnt = 0; DecodeCom(iobuf); USART1->CR1 |= USART_CR1_RXNEIE; //Enable RXNE interrupt myusart1.PrintString((uint8_t *) '\n\tInterrupt finished\n ', 0); } } return;}Every input character is correctly catched
Function DecodeCom() is correctly executedCheck string ('interrupt finished') correctly sent to pcThen sometime MCU stops (that is no further program line is executed), sometime program continue its run.
It seems the problem could be in return from routine but I do not know where I can checkAny hint?
Thank you
Freya