I'm using MKE17Z256 in my project with MCUXpresso
The microcontroller runs for a few seconds and break. This happens when I use the new data interrupts on reception.
I'm using an interrupt from UART 1 and UART 2 to signal when to get to a new buffer.
In other families I have like MKL15 or MKL25 this never happened.
Here is my code for analysis:
USB:
void INT_USB_LPUART_IRQHandler(void) {
/* If new data arrived. */
if ((kLPUART_RxDataRegFullFlag) & LPUART_GetStatusFlags(LPUART_USB)) {
LPUART_ReadBlocking(LPUART_USB, &buffer_usb_rx,
NUM_BYTES_USB_RX);
flag_novo_dado_usb_rx = 1;
LED_USB(2);
}
SDK_ISR_EXIT_BARRIER;
}
RS485:
void INT_RS485_LPUART_IRQHandler(void) {
/* If new data arrived. */
if ((kLPUART_RxDataRegFullFlag) & LPUART_GetStatusFlags(LPUART_RS485)) {
LPUART_ReadBlocking(LPUART_RS485, &rs485_buffer_rx1,
RS485_TAMANHO_BUFFER_RX);
LED_RS232_TELEMETRY(2);
flag_novo_buffer_rx = 1;
}
SDK_ISR_EXIT_BARRIER;
}