Emulated UART on KL uC

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

Emulated UART on KL uC

跳至解决方案
1,940 次查看
DolomitiLynx
Contributor III

Hi Freescaler,

I'm designing a board based on KL25 low power uC with some I/O and four uart RS232 ports. The first three are provided from the peripheral of the uC, the fouth is another story. My idea is to use an IRQ pin to detect falling edge on the RX line of the uart and to detect the start bit, and a generic pin controlled by a TPM module for the TX line.  Another timer will scan the signal on the RX line, 16 time faster than the baudrate of the serial line. I don' t need a fast uart, 9600bps is enough for my application.

Some of you have afforted a similar task? Or have a better idea than the one describer above? I'm also evaluating to add an I2C to UART driver bridge, but this

will increment component count of my board, and would be the worst solution.

Thanks in advance.

Giulio

0 项奖励
回复
1 解答
1,450 次查看
Paul_Tian
NXP Employee
NXP Employee

Hi, Giulio

Your mentioned is correct. As normal, we use timer and GPIO to simulate UART. You can also find some sample C code from internet. Here I just want to remind one issue for your reference. When you use GPIO to simulate UART, please use overflow interrupt solution not counter. This method will better when it is used in recevier part.

Hope my reply is helpful.

Best Regards

Paul

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,450 次查看
DolomitiLynx
Contributor III

Anyone interested on this thread?

Implementing uarts ports using GPIO and TPM module could be an easy way to add uarts connectivity to low count pins Kinetis uC that have only one or two UART dedicated module!

I see many application for this, and it could be also a very good application note for the explanation of TPM and IRQ Pin capabilities.

Best Regards

Giulio

0 项奖励
回复
1,451 次查看
Paul_Tian
NXP Employee
NXP Employee

Hi, Giulio

Your mentioned is correct. As normal, we use timer and GPIO to simulate UART. You can also find some sample C code from internet. Here I just want to remind one issue for your reference. When you use GPIO to simulate UART, please use overflow interrupt solution not counter. This method will better when it is used in recevier part.

Hope my reply is helpful.

Best Regards

Paul

0 项奖励
回复
1,450 次查看
DolomitiLynx
Contributor III

Thanks for your answer, Mr Zhe!

1.

Do you think the better way is to use two TPM enabled pins (like PTA0, PTA1 on KL25) both for RX and TX or to use a TPM enabled pin for TX and IRQ capable pin for RX?

2.

Do you know where I can found an example of this kind of implementation?

Best Regards

0 项奖励
回复
1,450 次查看
Paul_Tian
NXP Employee
NXP Employee

Hi, Giulio

1. I think it is better to use two TPM. But in function, these two solution has no larger difference.

2. Attached is for your reference. This is not special for KL. But I think it is easily to porting.

Hope my reply can help you.

Best Regards

Paul

0 项奖励
回复