2015-08-13 09:47 PM
I want to know how should i connect RE and DE pins to max485 via GPIO pin and how RE and DE pins are mapped to DB9 pin
#stm32 #serial #rs4852015-08-13 10:34 PM
Review Figure 20
http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/CD00298596.pdf
2015-08-14 05:18 AM
Thanks for the reply I've gone through the figure but still I'm not getting how i should control RE and DE pin in 485 through one of the GPIO pins on my board.
2015-08-14 07:35 AM
You have to use the USART in half-duplex mode, and manage the direction of the RS-485 bus so you're either talking or listening. You'd control the one GPIO to determine when you drive signal on to the wires. When you're transmitting you'd just hear yourself, so that's why the pins are tied together.
The RE/DE pins don't go to the DB92015-08-16 10:43 PM
Thanks for replying clive. According to your explanation i should control my transmission depending on one GPIO pin (set for TX and reset for RX). What i have is TTL to RS232 converter and RS232 to RS485 converter then how i connect RE and DE. do i need to use this product to control RE and DE?
http://yourduino.com/sunshop2/index.php?l=product_detail&p=323
2015-08-17 07:13 AM
What i have is TTL to RS232 converter and RS232 to RS485 converter
Re-examine the Figure 20 diagram Clive1 recommended. What you need is usart tx and rx connected to RS-485 DI and DO, and 1 GPIO to control direction on RE and DE. RS-485 A and B go to whatever RS-485 device or bus you are communicating with. The RS-232 is not required, and in the diagram Clive1 recommended, goes to pins functionally independent of the RS-485 on the DB-9 connector. Cheers, Hal2015-08-17 08:41 AM
Yes, I don't know where this RS232 requirement comes from. The MAX485 transceiver uses a two wire signal interface, only a single device can transmit at a time. The RE/DE are used to control access to the connection, and it's direction.
You could control the pins independently, but you'd just receive the data you were sending, which you presumably already have. So you're looking to turn on the transmitter, and turn off the receiver, in the transceiverhttps://en.wikipedia.org/wiki/RS-422
orhttps://en.wikipedia.org/wiki/RS-485
?http://datasheets.maximintegrated.com/en/ds/MAX1487-MAX491.pdf
2015-08-17 09:30 AM
When you need to convert from RS-232 to RS-485 the main issue is the transition from a full duplex interface (RS-232) to a half-duplex interface (RS-485). Assuming only the RS-232 is connected to a controller then you need to use one of the extra RS-232 pins as a direction control. A common way to do this is the RTS pin, which is normally an output (depending on DTE or DCE wiring) and use it for the direction control into the RS-485 converter.
If the RS-485 converter operates at RS-232 voltage levels for the direction (RE and DE) then all you need to do is connect the RTS pin on the RS-232 side to both RE and DE. But if the converter has these pins at TTL levels then you have to find some way to shift the RTS to a TTL level, or pass the TTL level directly to the RS-232 connector (risky as it will no longer be truly RS-232 compatible, plugging in something else may damage the TTL level GPIO pin and the controller). Aside from the hardware connection you also have to allow for line turnaround, meaning there has to be a gap between sending data and receiving data on the RS-232 side. And you can't do both at the same time, meaning you can't echo back the RS-232 data. You have to send entire messages, not just character at a time. Interfacing like this actually goes back to early days of networked computers in the 60's (look up the Bell 202 modem and the BISYNC protocol). The RTS and CTS pins exist on the RS-232 side for just this sort of problem, controlling when to send and when to receive on a half duplex connection. Jack Peacock2015-08-17 11:14 AM
Yes, I don't know where this RS232 requirement comes from.
I'm guessing Figure 2 in your reference, which shows the RS-485 teeing to RR-232 and DB9 instead of connecting only to DB9. Figure 20 provides correct guidance. Cheers, Hal2015-08-17 12:12 PM
do i need to use this product to control RE and DE?
http://yourduino.com/sunshop2/index.php?l=product_detail&p=323
Cancel my guess above. I presume you are trying to connect a PC USB to RS-232 serial converter to the F0 via an RS-485 bus. To do that, you will need a 232 to usart TTL converter such as a MAX 3232, then connect the MAX TTL level signals to an RS-485 chip and 485 bus as described above, connect the bus to another 485 chip connected to you F0. The schematic in the RS485 link above illustrates an easier solution. Connect your PC to a USB to RS485 transceiver (SKU EA-100902) connected to the bus, then connect the bus to a RS485 to TTL transceiver (SKU EA-100901) which then connects directly to the F0. Cheers, Hal