cancel
Showing results for 
Search instead for 
Did you mean: 

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

Ved.19
Associate II

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?

4 REPLIES 4
gbm
Lead III

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
Associate II

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

> 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
Associate II

I found it. Thank you.