TWR-K64F120(KDS) UART5 ISSUE

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

TWR-K64F120(KDS) UART5 ISSUE

Jump to solution
881 Views
kooroshhajiani
Contributor III

I can run the Hello World demo on TWR-k64f120 board(KDS) using UART1  as debug port and it works and communicates to PC  using Virtual COM port.

When I try to switch to UART5 , by doing the following:

 

Port_HAL_SetMuxMode(PORTE,9u,kPortMuxAlt3);

Port_HAL_SetMuxMode(PORTE,8u,kPortMuxAlt3);

AS I step through the code, when it gets to Port_HAL_SetMuxMode  it hangs in some ISR that basically just spins forever (default ISR).

I can't tell which ISR it is in.

Actually this demo seems to work only for UART1 , I TRIED THIS FOR ANYOTHER UART and it does the same thing.

 

I'm running out of ideas and need help with this.

Please advice.

 

 

 

 

 

Thanks,

Koorosh Hajiani

 

 

 

 

 

 

Labels (1)
0 Kudos
1 Solution
666 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Koorosh Hajiani:

Most peripheral modules require a clock gate to be enabled first, otherwise any access to the related registers triggers a hardfault. In your case you are most probably missing the clock gate for PORTE, like this:

CLOCK_SYS_EnablePortClock(PORTE_IDX)


Best Regards!
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
8 Replies
666 Views
DavidS
NXP Employee
NXP Employee

Hi Koorosh,

I'm assuming you are using the KDS_3.1+KSDK_1.3 and the hello world for C:\Freescale\KSDK_1.3.0\examples\twrk64f120m\demo_apps\hello_world\kds .

I had to do the following modifications to get the TWR-K64F+TWR-SER working for UART5 to the DB-9 connector.

hardware_init.c

void hardware_init(void) {

  /* enable clock for PORTs */

  CLOCK_SYS_EnablePortClock(PORTA_IDX);

  CLOCK_SYS_EnablePortClock(PORTC_IDX);

#if 1 //DES 1=needed when UART5 of TWR-K64F used with TWR-SER card, 0=default code

  CLOCK_SYS_EnablePortClock(PORTE_IDX);

#endif

  /* Init board clock */

  BOARD_ClockInit();

  dbg_uart_init();

}

board.h

/* The UART to use for debug messages. */

#ifndef BOARD_DEBUG_UART_INSTANCE

#if 0 //DES 1=UART1 (VCOM)...default code, 0=UART5(TWR-SER)...test code

    #define BOARD_DEBUG_UART_INSTANCE   1

    #define BOARD_DEBUG_UART_BASEADDR   UART1

#else

    #define BOARD_DEBUG_UART_INSTANCE   5

    #define BOARD_DEBUG_UART_BASEADDR   UART5

#endif

#endif

Regards,

David

666 Views
kooroshhajiani
Contributor III

Sorry forgot the other capture. So I too have the same code, yet  terminal is mute.I'll scope it and see if anything coming out of the DB9 connector

board.h

137134_137134.PNGCapture2.PNG

There are some jumpers J10/J15 I've removed them but I don't believe they've anything to do with it

                   

0 Kudos
666 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Koorosh:

Did you get this working?

I tried TWR-SER2 with the same changes as David and it worked. In the serial board there are just 3 jumpers you need to check:

J13: 1-2

J1: 2-3

J2: 2-3

Regards!

Jorge Gonzalez

666 Views
kooroshhajiani
Contributor III

Hi Jorge,

I got it working, Just played with those jumpers and used a scope to see what connects to what.

Thanks for  all the help.

Koorosh Hajiani

0 Kudos
666 Views
kooroshhajiani
Contributor III

Hi David,

Thanks for your response,

Capture1.PNG

0 Kudos
666 Views
kooroshhajiani
Contributor III

Sorry forgot the other capture. So I too have the same code, yet  terminal is mute.I'll scope it and see if anything coming out of the DB9 connector

board.h

Capture2.PNG

There are some jumpers J10/J15 I've removed them but I don't believe they've anything to do with it

0 Kudos
667 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Koorosh Hajiani:

Most peripheral modules require a clock gate to be enabled first, otherwise any access to the related registers triggers a hardfault. In your case you are most probably missing the clock gate for PORTE, like this:

CLOCK_SYS_EnablePortClock(PORTE_IDX)


Best Regards!
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
666 Views
kooroshhajiani
Contributor III

Thank you Jorge ,

You are correct.

The code is not hanging anymore.

I'm trying to communicate using  the DB9  Connector on TWR-SER2 board instead of the virtual com port (open cds), That's why I needed to configure UART5 on TWR-K64F120 instead of UART1  which is the default UART for the demo as suggested by Robin_Shen earlier which makes sense.

I configured UART5 and connected DB9 to a Serial_USB  jack  to the PC (DEVICE MANAGER ASSIGNS A COM PORT FOR THE JACK) and there is nothing on the terminal.

Any Ideas what is missing here. Jumpers setting ? Configuration?

Thanks

Koorosh Hajiani

0 Kudos