2018-04-10 08:58 AM
Hi all,
Checking a schematic of an RX485 transceiver connected to STM32F401 UART, I got into this detail that captured my attention:
The RX line is directly connected to the RX pin of UART1 of the the MCU and it is pulled up to 5V, there is not level adapter between.
The UART pins on the MCU are 5V tolerant but, checking into the configuration settings on STMCube configurator I found out that RX and TX pin have the pull-up settings activated and it is not possible to modify this setting (at least in the configurator...
pulling up to 5V externally the line could be ok because the pin is 5V tolerant, I did it previously on I2C lines but they were configured as open drain.
What does it happen if I apply 5V to a PIN that is internally pulled up to 3.3V? Does the MCU is damaged?
Is it possible to configure the UART pins as open drain or disable the pull-up?
Thanks
2018-04-10 10:43 AM
>>Is it possible to configure the UART pins as open drain or disable the pull-up?
Yes
If you have external pull-ups, select the NOPULL setting
The peripheral determines if a specific pin is used as an Input or Output, clearly as an Input it's not going to be using the output transistors to drive the pin high or low, so the PP vs OD setting there isn't material.
2018-04-10 02:37 PM
Hello Clive!
Thank you for your prompt support, as usual. Got the point.
Thinking about it, it is obvious that on the rx line, being an input, PP vs OD has no point!!
2018-04-10 03:57 PM
I would be surprised if you actually need to pull the RO pin to 5V (not 3v3.)
The 'High' threshold is approx 2V either way, pull up to 3v or 5v won't worry the RS485 output.
You could try to pull up to 3V3 and your issue will go away.
2018-04-10 04:21 PM
I back again because I think there is a kind of bug in the CubeMX configurator. The MCU is an STM32F401. If I go into the pin configuration tag, it addresses the RX pin like an output. I tried to configure an STM32F103 and it works correctly with the RX as input and the selection to disable the pull-up. Also the generated code reflects this misbehavior.
2018-04-11 09:36 AM
Hello!
Reading the datasheet High thresold is 2V for D, DE and RE
But for R the thresold is 4.6V
I think the solution could be switching the transceiver to a 3.3V rated part. But I would like to keep this for commonality with other projects
2018-04-11 05:05 PM
How long is your cable?
You would want to stay with 5V parts if the cable length is over 100M.
The ST processor is 5V tolerant like Clive said, if you take the precautions/advice from Clive, it works well. and you get the long cable support.
2018-04-12 04:38 AM
Reasonably it will be shorter, but, despite very rare, there are few possibilities that it will exceed 100M. I have to take into account this case.
Thank you TJ for your support.