Software Serial/UART

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

Software Serial/UART

跳至解决方案
2,712 次查看
mayursavaj
Contributor III

Hi,

We are using MK22Fx512 controller of Cortex-M4 series.

I want to use ADC (Pin 15/16/17) as UART-Rx or UART Tx pin as UART Rx because I don't have any UART pin left.

Will anyone suggest me how I will go about it?

Thanks in advance.

标签 (1)
0 项奖励
回复
1 解答
2,074 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

For pin No. 15, 16 and 17 only with ADC function, there is no way to using software UART with those pins.

For K22 UART  supports Single-wire operation mode, the UART TX could be used as UART transmit and receive pin in a half-duplex working mode.

Please check below picture for the detailed info:

1.png

2.png

3.png

Wish it helps.


Have a great day,
Ma Hui

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

在原帖中查看解决方案

0 项奖励
回复
5 回复数
2,074 次查看
egoodii
Senior Contributor III

You can certainly implement a 'timer-banged' UART, ala' AN2637.

Reception can use virtually any GPIO -- set a falling-edge trigger to grab the leading edge of the 'start bit', then set a timer for 'somewhat less' than 1/2 bit-time (to compensate for interrupt-response on this, and the subsequent bit-interrupt), thence on that interrupt re-sample 'start' and if valid set 9 more 'full bit' timer-interrupts in succession to sample the input pin to build up the byte, and end by checking 'stop'.  Variations in interrupt-response-time WILL affect the 'quality' of the 'center bit sampling'.

Sending is 'easier and better timed', but requires the use of a timer-output-pin.  For each bit to send, you just set the 'software triggered' output mode, at the bit-width, and on each interrupt you set the NEXT 'state to set at timer expiration' per the next output-bit value.  THIS interrupt-response time is 'relaxed' and only HAS to respond in less than a bit-time.

0 项奖励
回复
2,074 次查看
mjbcswitzerland
Specialist V

Earl

The MK22Fx512 is available in a number of packages and as far as I can tell (without being 100% sure though) the pins 15, 16 and 17 referred to are probably on a 64 pin part where they are exclusively ADC (no GPIO function).

Mayur - could you be more specific as to the part number (specifically the pin-count) and which pins are actually being referred to?

Regards

Mark

0 项奖励
回复
2,074 次查看
mayursavaj
Contributor III

Hi Mark,

I am using MK22FX512VLL12 of kinetic K series. It have 100 pin package.

Pin No 15, 16 and 17 is dedicated to exclusively ADC.

Can i use this pin as UART Rx? if yes than How?

I have one more pin left UART Tx. Can i use UART-Tx as UART-Rx? if yes than How.

Please give your feedback.

Thanks.

0 项奖励
回复
2,075 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

For pin No. 15, 16 and 17 only with ADC function, there is no way to using software UART with those pins.

For K22 UART  supports Single-wire operation mode, the UART TX could be used as UART transmit and receive pin in a half-duplex working mode.

Please check below picture for the detailed info:

1.png

2.png

3.png

Wish it helps.


Have a great day,
Ma Hui

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

0 项奖励
回复
2,074 次查看
mayursavaj
Contributor III

Thanks Hui Ma,

0 项奖励
回复