UART 2 in KSDK V 2.0 issue

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

UART 2 in KSDK V 2.0 issue

1,454 Views
anilnadargi
Contributor II

Hi ,

 

We are working on MK27Z256MV4 SOC . We are currently working on UART module on K SDK 1.X with Processor exper and KSDK V 2.0 without processor expert .

 

We are able to communicate over UART module using Processor expert driver with KSDK 1.X version 

But we are not able to work the UART module using KSDK V 2.0 driver . 

 

Below are the pin mux settings in pin_mux.c file of the project .

PORT_SetPinMux(PORTD, PIN2_IDX, kPORT_MuxAlt3);            /* PORTD2 (pin C2) is configured as UART2_RX */

PORT_SetPinMux(PORTE, PIN22_IDX, kPORT_MuxAlt4);           /* PORTE22 (pin G2) is configured as UART2_TX */

 

and we are using RTOS UART APIs as below , 

UART_RTOS_Send () and UART_RTOS_Receive () . 

 

 

Thanks ,

Anil N

Labels (1)
0 Kudos
Reply
5 Replies

1,169 Views
jensseifr
Contributor II

Hi Anil,

i had a similiar problem over UART2 on MKL25Z128 with SDK2.0 and the RTOS UART APIs Functions UART_RTOS_Send () and UART_RTOS_Receive (). I think the Driver is nearly identical.

My misstake was not to set the "configTIMER_TASK_PRIORITY" in FreeRTOSConfig.h to highest Priority (configMAX_PRIORITIES-1), because the xTimerQueue need to process the "Eventbitmessage" instantly.

Else the Callback-Function is setting the Eventbit  "RTOS_UART_COMPLETE" to end the "xEventGroupWaitBits"-Period after starting Transfer, but the Eventbit was not received instead cause the Timertask stucks behind other Tasks.

Maybe u can solve ur Problem the same way.

Regards

Jens

0 Kudos
Reply

1,169 Views
anilnadargi
Contributor II

Sorry SoC is  MKL27Z256VMP4

Anil N

0 Kudos
Reply

1,169 Views
DavidS
NXP Employee
NXP Employee

Hi Anil,

Did you enable the UART2 clock in the SIM_SCGC4 register?

Did you initialize the UART2 as well?

Regards,

David 

0 Kudos
Reply

1,169 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I suppose you use the example code located at:

C:\Freescale\KSDK2.0_KL27\boards\frdmkl27z\rtos_examples\freertos_uart\kds

The example use UART2 and PTD2 and PTD3 as UART2_RX and UART2_TX. If you use PTE22 as UART2_TX, as David said, you have to enable PORTE clock and set the PTE22 port with the code:

CLOCK_EnableClock(kCLOCK_PortE);

PORT_SetPinMux(PORTE, PIN22_IDX, kPORT_MuxAlt4);           /* PORTE22 (pin G2) is configured as UART2_TX */

Hope it can help you

BR

Xiangjun Rong

0 Kudos
Reply

1,169 Views
anilnadargi
Contributor II

Hi Ring,

Thanks for your inputs . We already have the changes mentioned by you . The issue is with data loss in reception . We are Able to perform TX part . But during Rx , we are loss some data bytes out of total bytes received.we are using rtos api for Uart driver .The non rtos api interrupt example works perfect.but when switch to rtos api for blocking mechanism it's drops some bytes or sometimes no data even though we see data on Rx line on Digital Oscilloscope.we tried both with and without ringbuffer .

0 Kudos
Reply