K60 uart, PF and FE flags problem

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

K60 uart, PF and FE flags problem

753 Views
veronicam
Contributor I

Hi,

I'm working with the K60 microcontroller, in  particular the UART0 peripheral.

I can't make it run properly.

In attached you can find the initialization function.

I set M (9 bits), PE (parity enable) and PT (odd parity) bits in C1 register and RX-TX interrupt is enabled.

When I send a byte, the UART adds the bit parity properly.

When I receive a byte with wrong bit parity, the bit PF in S1 register isn't set. (In the attached file, K60 never sets PE in S1 register and it doesn't goes in 

if (StatusUART & UART_S1_PF_MASK)
{
   error |= HART_ERROR_VERTICAL_PARITY;
}

 

I have done several tries but I can't find the solution.

Is the peripheral correctly configured? Do I correctly read/manage S1 register?

 

Thanks

Veronica

Original Attachment has been moved to: UART_K60.txt.zip

Labels (1)
0 Kudos
3 Replies

578 Views
kriske
Contributor II

Dear Jorge Alcala

I saw the SIM_SOPT5 have a register is UART0TXSRC and the function descriptions is UART0_TX pin modulated with TPM1 channel 0 output.

It's mean the TX frequency is same to TPM1?

I saw the UART register have receive overrun, parity error, framing error, and noise error, but not much description how to use it. 

Does NXP have any application note can description how to use those UART error?

If I get a receive overrun, Do I need  to discard the erroneous data or do what?

BTW, Have any document show the error spec? 

BR

Kris

0 Kudos

578 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Kris

TX modulated means that UART0_TX pin output will pass trough an AND with FTM0 channel 0 before mapped to pinout:

2015-07-21_10-03-48_2.jpg

So UART has configured his baud rate as normal, but if the data in 1, the output will have the FTM frequency, this is very used in irda communication, please check: Implementing infrared functions on UART0 with FRDM-KE02Z platform. 

NXP has not a document that explain how to manage errors from UART communication, it actually depends in the user application, it depends on you to check if you have a error flag and decide what to do ones that this error has been set. Please check datasheet for specifications of the MCU.


Hope this information helps you
Have a great day,
Jorge Alcala

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

0 Kudos

578 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Veronica Malori

How do you send data to UART0? as I see in your code, you have set the 9 bits data, but when parity enable, you actually have to sent a 8 bits data plus the parity bit, and the Parity flag will set consider your C1[M], so it will consider C3[R8] bit in the count of parity check if 9 bits enable. So, as you have your setup, you have to send start bit+ 8 bits data + parity bit + stop bit.


Hope this information helps you
Have a great day,
Jorge Alcala

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

0 Kudos