Skip to main content
Ved.19
Associate
March 20, 2023
Question

How to add delay before switching Tx/Rx mode in USART Async RS-485 mode (Hardware flow control).

  • March 20, 2023
  • 4 replies
  • 2458 views

I am using USART 1 and USART 2 of STM32L56VE series microcontroller in RS-485(Hardware flow control) in Async mode, I am using PA9(TX),PA10(RX),PA12(RTS),PD4(RTS),PD5(TX) and PD6(RX) pins. I have observed Transceiver is switched to send immediate at begin of start bit and set back to receive immediate after stop bit. I want to add a delay of ~30us before immediately switching between modes (Rx/Tx)

In STM IDE there is a smartcard mode to add guard time, however it is not available for Asyc RS-485 mode.

I have pull-up resistor of 10K connected on Rx and Tx pins and pull-down resistor of 10k on RTS pins of both USART 1 & 2.

My question is whether a delay/guard time is required as I already have pull-up resistors connected?

What is the way I can achieve ~30us of delay/guard time if it is really required?

@Frantz LEFRERE​ Can you please help me here?

This topic has been closed for replies.

4 replies

gbm
Lead III
March 20, 2023

Look at DEAT and DEDT fields in CR1 register.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
Ved.19
Ved.19Author
Associate
March 20, 2023

Sure, will look at that. Also, is there any HAL API available for same or we need to compulsory write registers?

waclawek.jan
Super User
March 20, 2023

> is there any HAL API available for same

Cube/HAL is open source, you can look this up easily yourself, just search for DEAT/DEDT.

JW

Ved.19
Ved.19Author
Associate
March 20, 2023

I found it. Thank you.