lack of RTS/CTS on MKL17 LPUARTx

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

lack of RTS/CTS on MKL17 LPUARTx

跳至解决方案
1,410 次查看
gschelotto
Contributor V

Hello,

I'm designing a serial cable replacement over BLE using the ATBTLC1000 SoC and MKL17Z MCU as external host. The ATBTLC1000 uses a 4-pin UART interface (RX, TX, RTS and CTS) that must be connected to the MCU UART and enabled for the UART interface to be functional. The problem is the LPUART on MKL17 has not any RTS/CTS lines for the hardware flow control. Is it possible to implement these 2 ports using GPIOs? Is there any workaround to solve this?

thanks in advance,

gaston

0 项奖励
回复
1 解答
1,148 次查看
mjbcswitzerland
Specialist V

Hi

Note that the uTasker project has HW flow control support for all devices, including those that don't have modem control integrated in the UART.
I have attached a video of its CTS line controlling transmission as reference.


RTS is set when the input buffer fills to above a definable watermark or can be controlled directly for RS485 type circuits.

RTS can be allocated to any GPIO and CTS to any GPIO with interrupt capability.

For example, in the video (showing simulation of KL27) I assign CTS to PTD0. The setup is simply three project defines as follows:

#define CTS_0_PORT PORTD
#define CTS_0_PIN PORTD_BIT0
#define CTS_0_INTERRUPT_PRIORITY PRIORITY_PORT_D_INT

and to set HW flow control I set the RTS_CTS flag for the interface when opening it:

...
tInterfaceParameters.Config |= RTS_CTS; // enable RTS/CTS operation (HW flow control)
SerialPortID = fnOpen(TYPE_TTY, ucDriverMode, &tInterfaceParameters);

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html
Kinetis KL25, KL26, KL27, KL28, KL82, KL43, KL46
- http://http://www.utasker.com/kinetis/FRDM-KL25Z.html
- http://www.utasker.com/kinetis/TWR-KL25Z48M.html
- http://www.utasker.com/kinetis/FRDM-KL26Z.html
- http://www.utasker.com/kinetis/TEENSY_LC.html
- http://www.utasker.com/kinetis/FRDM-KL27Z.html
- http://www.utasker.com/kinetis/Capuccino-KL27.html
- http://www.utasker.com/kinetis/FRDM-KL28Z.html
- http://www.utasker.com/kinetis/FRDM-KL82Z.html
- http://www.utasker.com/kinetis/FRDM-KL43Z.html
- http://www.utasker.com/kinetis/TWR-KL43Z48M.html
- http://www.utasker.com/kinetis/FRDM-KL46Z.html
- http://www.utasker.com/kinetis/TWR-KL46Z48M.html

Build with: CW10.x, KDS, MCUXpresso, IAR, Keil, Greenhills, Crossworks, CooCox, Atollic, S32 Design Studio, GNU Make and Visual Studio

UART - http://www.utasker.com/docs/uTasker/uTaskerUART.PDF
MODBUS - http://www.utasker.com/docs/MODBUS/uTasker_MODBUS.PDF

Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis

Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M

For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,149 次查看
mjbcswitzerland
Specialist V

Hi

Note that the uTasker project has HW flow control support for all devices, including those that don't have modem control integrated in the UART.
I have attached a video of its CTS line controlling transmission as reference.


RTS is set when the input buffer fills to above a definable watermark or can be controlled directly for RS485 type circuits.

RTS can be allocated to any GPIO and CTS to any GPIO with interrupt capability.

For example, in the video (showing simulation of KL27) I assign CTS to PTD0. The setup is simply three project defines as follows:

#define CTS_0_PORT PORTD
#define CTS_0_PIN PORTD_BIT0
#define CTS_0_INTERRUPT_PRIORITY PRIORITY_PORT_D_INT

and to set HW flow control I set the RTS_CTS flag for the interface when opening it:

...
tInterfaceParameters.Config |= RTS_CTS; // enable RTS/CTS operation (HW flow control)
SerialPortID = fnOpen(TYPE_TTY, ucDriverMode, &tInterfaceParameters);

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html
Kinetis KL25, KL26, KL27, KL28, KL82, KL43, KL46
- http://http://www.utasker.com/kinetis/FRDM-KL25Z.html
- http://www.utasker.com/kinetis/TWR-KL25Z48M.html
- http://www.utasker.com/kinetis/FRDM-KL26Z.html
- http://www.utasker.com/kinetis/TEENSY_LC.html
- http://www.utasker.com/kinetis/FRDM-KL27Z.html
- http://www.utasker.com/kinetis/Capuccino-KL27.html
- http://www.utasker.com/kinetis/FRDM-KL28Z.html
- http://www.utasker.com/kinetis/FRDM-KL82Z.html
- http://www.utasker.com/kinetis/FRDM-KL43Z.html
- http://www.utasker.com/kinetis/TWR-KL43Z48M.html
- http://www.utasker.com/kinetis/FRDM-KL46Z.html
- http://www.utasker.com/kinetis/TWR-KL46Z48M.html

Build with: CW10.x, KDS, MCUXpresso, IAR, Keil, Greenhills, Crossworks, CooCox, Atollic, S32 Design Studio, GNU Make and Visual Studio

UART - http://www.utasker.com/docs/uTasker/uTaskerUART.PDF
MODBUS - http://www.utasker.com/docs/MODBUS/uTasker_MODBUS.PDF

Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis

Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M

For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html

0 项奖励
回复
1,147 次查看
gschelotto
Contributor V

Mark, thank you for clarifying this. I'll take into account the uTasker project.

regards,

gaston

0 项奖励
回复