UART problem on K60 (parity)

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

UART problem on K60 (parity)

跳至解决方案
2,507 次查看
UniversalTroope
Contributor III

Hello, I'm having some problems with UART3 on the K60 Tower board (Rev. C) (the one that's connected to the RS232 port on the serial board).

 

I'm trying to send data out, but when I want to use parity, I get only garbage (verified on two computers, with two different serial cables).

 

The included source file replaces nill.c in the MQX 3.7 example nill.

 

I'll be very happy if someone can see where the problem is, or even just verify the problem on their K60/serial board.

 

0 项奖励
1 解答
1,001 次查看
anthony_huereca
NXP Employee
NXP Employee

Make sure the terminal settings are set up correctly. In 8-bit mode, the 8th bit is the parity bit, and thus you only have 7 data bits. So make sure the terminal is setup for only 7-data bits.

 

If you need 8-data bits, then the UART should be setup in 9-bit mode.

 

See the note in Section 51.3.8 or section 51.4.4.1in the RM.

 

-amh

在原帖中查看解决方案

0 项奖励
5 回复数
1,001 次查看
UniversalTroope
Contributor III

Thanks! Setting options to 9 databits solved the problem.

 

I'm using the MQX driver, and not bare metal. It seems like something the MQX driver should take care of, or at least should be mentioned in the serial driver section of the MQX I/O drivers user guide. Maybe it's a standard way to do it, and I just have insufficient serial port driver experience, but it's not exactly logical.

0 项奖励
1,001 次查看
anthony_huereca
NXP Employee
NXP Employee

How each part implements parity can be different. So while on Kinetis it means you only have 7 data bits, on a S08 part it still might mean you have 8. So it does requires a little bit of knowledge of the part in this case, since the driver is just turning on parity for your part, and doesn't know neccesarily what you "meant" to happen. Someone else moving from bare-metal to MQX might think it odd if it didn't take away a data bit for example :smileyhappy:

 

-amh

0 项奖励
1,001 次查看
UniversalTroope
Contributor III

Exactly the same problem on UART 1.

 

Has anyone successfully used parity on any Kinetis UART?

0 项奖励
1,002 次查看
anthony_huereca
NXP Employee
NXP Employee

Make sure the terminal settings are set up correctly. In 8-bit mode, the 8th bit is the parity bit, and thus you only have 7 data bits. So make sure the terminal is setup for only 7-data bits.

 

If you need 8-data bits, then the UART should be setup in 9-bit mode.

 

See the note in Section 51.3.8 or section 51.4.4.1in the RM.

 

-amh

0 项奖励
1,001 次查看
mjbcswitzerland
Specialist V

Hi

 

See also page 25/40 of http://www.utasker.com/docs/KINETIS/uTaskerV1.4_Kinetis_demo.pdf

 

Regards

 

Mark

 

0 项奖励