AN2295SW bootload Uart error

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

AN2295SW bootload Uart error

跳至解决方案
1,151 次查看
eunseokjung
Contributor II

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.

标签 (1)
0 项奖励
1 解答
927 次查看
pavel_krenek
NXP Employee
NXP Employee

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

在原帖中查看解决方案

0 项奖励
7 回复数
927 次查看
pavel_krenek
NXP Employee
NXP Employee

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

0 项奖励
927 次查看
eunseokjung
Contributor II

I noticed that interrup is caused by this.

(tIsrFunc)&Cpu_Interrupt,          /* 0x03  0x0000000C   -1   ivINT_Hard_Fault               unused by PE */

How to solve this problem?

0 项奖励
928 次查看
pavel_krenek
NXP Employee
NXP Employee

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

0 项奖励
927 次查看
Jorge_Gonzalez
NXP Employee
NXP Employee

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

927 次查看
eunseokjung
Contributor II

I found that MK10 UART0 base pointer is 0x4006A000.

That value is correct.

But it makes error.

Why it makes error?

0 项奖励
927 次查看
eunseokjung
Contributor II

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.

0 项奖励
927 次查看
eunseokjung
Contributor II

Thanks pavel.

The cup is a typing error.

Thx.

0 项奖励