View previous topic :: View next topic |
Author |
Message |
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
usb to rs485 full duplex communication |
Posted: Thu Mar 19, 2020 5:26 am |
|
|
Hello everyone
I want to make RS485 double duplex communication from usb. But I can get data from Siow. exe, but I cannot send data. I want to see the data I sent on the LCD screen. There is no problem in the program. It works bidirectionally on RS232. The problem is hardware. Do you think there is an error? what can I do?
onedrive link:
https://1drv.ms/u/s!AskLNX_iFag3gfRflVtsl9jtpRfTPA _________________ Es |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Thu Mar 19, 2020 5:51 am |
|
|
I don't see a problem.
For testing you should be able to 'loopback', connect 'A' to 'Z', 'B' to 'Y'.
then any PC KBD key pressed should be displayed on the PC screen.
jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Thu Mar 19, 2020 7:45 am |
|
|
Actually you need B to Z and A to Y.
Z is the inverting output. B is the inverting input.
The wiring order on the connector, makes me suspect the connection
order may be wrong. 2 to 3. 1 to 4. |
|
|
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
|
Posted: Thu Mar 19, 2020 8:07 am |
|
|
my connection;
microprocessor side
4-terminal block <-------------------------->PC 4-terminal block
1- Y ----------------------------------------> A
2- Z ----------------------------------------> B
3- B ----------------------------------------> Z
4- A ----------------------------------------> Y _________________ Es |
|
|
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
|
Posted: Thu Mar 19, 2020 8:48 am |
|
|
Not working. _________________ Es |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Thu Mar 19, 2020 9:28 am |
|
|
As Jay says, try looping the connections back, and see if it then works.
If it does, you then know the serial is getting to the transceiver, and being
received by the transceiver. At this point you then need to double check the
actual connections at the other device. What is it?. Are you sure there is not
something 'silly' like the manufacturer labeling the pins in the reverse order.
Data on this device. Essential...
Given that RS485 does not have a specified 'pin out', this is where I'd
start. |
|
|
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
|
Posted: Fri Mar 20, 2020 12:10 am |
|
|
There are 120 ohms resistor on the PIC side A, B - Y, Z side. So will it be on both sides? Does it have to be on both the PIC side and the USB side?
I mean, I do. Is it correct?
USBtoRS485 <-------------------------------------> PIC side
A> ------------------------------------------------ ---------> Y
120ohm____________________________________120ohm
B> ------------------------------------------------ ---------> Z
Y> ------------------------------------------------ ---------> A
120ohm ____________________________________120ohm
Z> ------------------------------------------------ ---------> B _________________ Es |
|
|
emaxxenon
Joined: 21 Jan 2020 Posts: 42
|
|
Posted: Fri Mar 20, 2020 12:22 am |
|
|
I cannot access the link.
Can you renew? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Fri Mar 20, 2020 1:48 am |
|
|
OK.
On RS485, the resistors may provide two separate jobs.
The first is signal termination. If you send any digital signal along a wire,
when this waveform reaches the end of the wire it tends to 'bounce' off
the open signal end. Stick a fast, signal into a wire with no termination,
and if you stick a scope onto the wire, depending on the length of the
wire and the frequencies used, you will see multiple repeats of the edges
'ringing' up and down the wire.
Now, wires have characteristic impedance's. So (for instance) Cat5
ethernet cable has a characteristic impedance around 100R. A lot of
co-axial cables have impedance's of 50R. This is part of the cable spec.
If at the end of the wire, you put a resistor who's value is a close match
to the impedance of the cable, this massively reduces this reflection.
So the resistors at each end, should be a close match to the cable being
actually used. The resistors should be near to the physical ends of the cable.
(normally within less than 100mm). The value depends on the wire
being used.
However the problem of termination changes massively with frequency.
A signal at perhaps 1200bps, using slew rate limited drivers, will get
through fine with no problems from reflection, with no termination.
A signal at ten times this speed may start to show problems on long
wires. Signals in the hundreds of KHz+ rates, absolutely must have
good termination. if the wire length is at all significant.
The formula for this is signal wavelength/10. If the bus wire is shorter
that this, it should probably run OK with no termination. The signal
wavelength is taken typically as 1/(2*Tr), where Tr is the rise time
of the digital signal. The 1488 drivers have a 'worst case' (_fastest_)
slew time of 3nSec, so in this worst case problems can start to appear
on busses just over 180mm in length.
This is why if you are only sending low baud rate signals, using a
slew rate limited driver, may be a 'good idea', as it reduces the frequencies
the wire has to handle, and if these are not needed by the signal, allows
longer wires to be used without termination.
Inadequate termination, will not stop the signal being received. What
happens is you will get corruption, as the reflected 'copies' get received
as well.
The second function is to bias the bus to the 'off' state when it is not being
driven. However this only applies on half duplex buses. On full duplex
this biasing is not needed.
A termination value within +/-20% of the wire impedance, will take
out 80% of the reflection. 120R is an acceptable match for twisted pair
cables like those used for Can bus.
Now, slightly puzzled as to what you are actually trying to do?
You have a PIC that is capable of connecting to USB, and has a serial
interface, so why is another USB to RS485 interface involved at all?.
The PIC is perfectly capable of providing USB to RS485.
Do you have a part number/pinout/data for the USB to RS485 interface you
are using?. Most do not label the RS485 as A/B & Z/Y, but as A/B TX
and A/B RX. Data is essential. |
|
|
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
|
Posted: Fri Mar 20, 2020 2:04 am |
|
|
The product codes I use
IC-488 TXRX LOW POWER RS485 / 422 SO8 MAXIM
FT232RL _________________ Es |
|
|
emaxxenon
Joined: 21 Jan 2020 Posts: 42
|
|
Posted: Fri Mar 20, 2020 2:37 am |
|
|
I had the same problem before. I couldn't see what happened at the address you gave.
My problem was the integrated one I used. Cannot select RX-TX. There are cards that do this job automatically. That's how I solved my problem.
edit:
ok sorry i got it wrong
Last edited by emaxxenon on Fri Mar 20, 2020 3:09 am; edited 1 time in total |
|
|
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
|
Posted: Fri Mar 20, 2020 2:46 am |
|
|
I understood you. I use it for bidirectional communication with max488. But you are trying to use max485 half duplex integration as a full duplex. I also have no software errors. Because I'm working bidirectionally on my code rs232. I'm investigating it on my bug hardware. _________________ Es |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Fri Mar 20, 2020 2:54 am |
|
|
The circuit you post, and the links are for _half duplex_, not duplex
operation. The normal issue with half duplex is getting the enable operation
and bus biasing to work correctly. These problems don't appear with duplex,
which is what is being talked about here.
To the original poster, the product code being listed is just for the max488.
The version here is the slew rate limited version. Now this is limited to an
absolute max 250Kbps. So how fast are you trying to run the bus?. For this,
Tr is 250nSec so provided you are running at a low baud rate supported by
this, reflection should not be a problem up to 15m bus length. I was asking
for the part number on the PC adapter you are using?. |
|
|
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
|
|
emaxxenon
Joined: 21 Jan 2020 Posts: 42
|
|
Posted: Fri Mar 20, 2020 3:03 am |
|
|
edit:
ok sorry i got it wrong
Last edited by emaxxenon on Fri Mar 20, 2020 3:07 am; edited 1 time in total |
|
|
|