AN2295SW bootload Uart error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AN2295SW bootload Uart error

Jump to solution
1,110 Views
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.

Labels (1)
0 Kudos
1 Solution
886 Views
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

View solution in original post

0 Kudos
7 Replies
886 Views
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 Kudos
886 Views
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 Kudos
887 Views
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 Kudos
886 Views
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

886 Views
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 Kudos
886 Views
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 Kudos
886 Views
eunseokjung
Contributor II

Thanks pavel.

The cup is a typing error.

Thx.

0 Kudos