Hello Vivek:
The BSPCFG_ENABLE_TTYD_HW_SIGNALS has influence on init_gpio.c, where it enabled RTS and CTS signals:
For example in the K60 device:
#if BSPCFG_ENABLE_TTYD_HW_SIGNALS
/* PTC18 as RTS function (Alt.3) + drive strength */
pctl->PCR[18] = 0 | PORT_PCR_MUX(3) | PORT_PCR_DSE_MASK;
/* PTC19 as CTS function (Alt.3) + drive strength */
pctl->PCR[19] = 0 | PORT_PCR_MUX(3) | PORT_PCR_DSE_MASK;
#endif
Pin functions are independent on the mode (polled/interrupted) of the serial IO driver.
Flow control then works depending on IO_SERIAL_HW_485_FLOW_CONTROL flag passed to serial io device. (refer to /mqx/examples/rs485).
When you open serial io device with IO_SERIAL_HW_485_FLOW_CONTROL flag, it will configure Kinetis UART module MODEM register:
case IO_IOCTL_SERIAL_SET_FLAGS:
// automatic HW flow control if (*param_ptr & IO_SERIAL_HW_485_FLOW_CONTROL) {
// RTS hw flow control - support for RS485
/* get serial device index and set GPIO pin functionality to RTS */
_bsp_serial_rts_init( io_info_ptr->INIT.DEVICE );
/* enable hardware support for 485 RTS pin drive */
sci_ptr->MODEM &= (~(UART_MODEM_RXRTSE_MASK | UART_MODEM_TXCTSE_MASK));
sci_ptr->MODEM |= UART_MODEM_TXRTSE_MASK;
}
else if (*param_ptr & IO_SERIAL_HW_FLOW_CONTROL) {
// RTS, CTS hw flow control sci_ptr->MODEM &= ~UART_MODEM_TXRTSE_MASK;
sci_ptr->MODEM |= (UART_MODEM_RXRTSE_MASK | UART_MODEM_TXCTSE_MASK);
}
else {
sci_ptr->MODEM &= (~(UART_MODEM_RXRTSE_MASK | UART_MODEM_TXCTSE_MASK | UART_MODEM_TXRTSE_MASK));
}
break;
shortly, BSPCFG_ENABLE_TTYD_HW_SIGNALS and IO_SERIAL_HW_485_FLOW_CONTROL are valid for both serial and interrupt mode serial I/O drivers.
Have a great day,
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------