michallenc commented on code in PR #18417:
URL: https://github.com/apache/nuttx/pull/18417#discussion_r2837716637
##########
arch/arm/src/kinetis/kinetis_serial.c:
##########
@@ -1896,7 +1896,102 @@ static int up_dma_nextrx(struct up_dev_s *priv)
static void up_send(struct uart_dev_s *dev, int ch)
{
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
+
+#if defined(CONFIG_UART0_RS485CONTROL_RTSISGPIO)
+ if (&g_uart0priv == priv)
+ {
+ kinetis_gpiowrite(g_uart0priv.rts_gpio, 1);
+ }
+
+#endif
+#if defined(CONFIG_UART1_RS485CONTROL_RTSISGPIO)
+ if (&g_uart1priv == priv)
+ {
+ kinetis_gpiowrite(g_uart1priv.rts_gpio, 1);
+ }
+
+#endif
+#if defined(CONFIG_UART2_RS485CONTROL_RTSISGPIO)
+ if (&g_uart2priv == priv)
+ {
+ kinetis_gpiowrite(g_uart2priv.rts_gpio, 1);
+ }
+
+#endif
+#if defined(CONFIG_UART3_RS485CONTROL_RTSISGPIO)
+ if (&g_uart3priv == priv)
+ {
+ kinetis_gpiowrite(g_uart3priv.rts_gpio, 1);
+ }
+
+#endif
+#if defined(CONFIG_UART4_RS485CONTROL_RTSISGPIO)
+ if (&g_uart4priv == priv)
+ {
+ kinetis_gpiowrite(g_uart4priv.rts_gpio, 1);
+ }
+
+#endif
+#if defined(CONFIG_UART5_RS485CONTROL_RTSISGPIO)
+ if (&g_uart5priv == priv)
+ {
+ kinetis_gpiowrite(g_uart5priv.rts_gpio, 1);
+ }
+
+#endif
+
up_serialout(priv, KINETIS_UART_D_OFFSET, (uint8_t)ch);
+
+#if defined(CONFIG_UART0_RS485CONTROL_RTSISGPIO)
+ if (&g_uart0priv == priv)
+ {
+ /* We need some time before RTS is set low. 150 us works for LTM2881. */
+
+ up_udelay(150);
Review Comment:
I think it would be better to disable the GPIO once `UART_S1_TC` interrupt
is received instead of magic 150 us wait.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]