Emulated UART on KL uC

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

Emulated UART on KL uC

Jump to solution
1,170 Views
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 Kudos
Reply
1 Solution
680 Views
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

View solution in original post

0 Kudos
Reply
4 Replies
680 Views
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 Kudos
Reply
681 Views
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 Kudos
Reply
680 Views
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 Kudos
Reply
680 Views
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 Kudos
Reply