Hi, all
I'm using MK10 series. I'm practicing bootloader with UART.
The problem is when i run the UART_IsChar() function, it always goes to cpu interrupt.
The UART_IsChar() function is so simple.
#define UART_IsChar() (UART_S1_REG(BOOT_UART_BASE) & UART_S1_RDRF_MASK) |
#define BOOT_UART_BASE UART0_BASE_PTR
#define UART0_BASE_PTR ((UART_MemMapPtr)0x4006A000u)
#define UART_S1_REG(base) ((base)->S1)
#define UART_S1_RDRF_MASK 0x20u
It is all about UART_IsChar() function.
When i run it, it always goes to CPU interrupt.
Do you have any idea?
Thank you.
已解决! 转到解答。
Hi,
base address is OK. We do not use interrupt driven driver for the UART communication, it is not possible that the interrupt is generated cause the UART.
It looks like a written to some non enabled peripheral or register, pls. check SIM registers as Jorge mentioned in the previous reply.
Pavel
Hi Eunseok,
what does it mean cup interrupt ?
Could you be more specific about the situation with UART ? This routine UART_IsChar() is only for checking if the receive buffer is full.
Regards,
Pavel
Hi,
base address is OK. We do not use interrupt driven driver for the UART communication, it is not possible that the interrupt is generated cause the UART.
It looks like a written to some non enabled peripheral or register, pls. check SIM registers as Jorge mentioned in the previous reply.
Pavel
Hello Eunseok Jung:
Have you enabled the UART0 clock gate?
Any access to UART0 registers with clock gate disabled will generate a hardfault. Try adding this code at the beggining:
SIM_SCGC4 |= SIM_SCGC4_UART0_MASK;
Regards!
Jorge Gonzalez
Hi, pavel.
I know what is the problem.
#define UART0_BASE_PTR ((UART_MemMapPtr)0x4006A000u)
When i run this command, the cpu goes to interrupt.
PE_ISR(Cpu_Interrupt)
{
PE_DEBUGHALT();
}
I think, i use wrong UART BASE PTR.
My MCU is MK10DX256VLL7.
How to find correct address value?
Thx.