RS485 network not running... please help!
-
Hi,
ok I started the next run, I checked the voltage levels (Multimeter is showing a differential of A&B of 0.2 V and is going up during sending.
The Breadboard has no short circuit potential, the wire is now 2x2x0.3 and about 50 cm long, I added R100 to each end...
Then I copied the sketches of the rs485 stresstest posted in the forum...
But it is not working though... ;-(
Any ideas?
Thank you.This is what the node prints now:
621470 TSM:FPAR
4621471 TSM:FPAR:STATP=0
4621474 TSM:ID
4621475 TSM:ID:OK
4621477 TSM:UPL
4621488 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
4623496 TSM:UPL
4623506 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
4625513 TSM:UPL
4625523 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
4627530 TSM:UPL
4627540 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
4629548 !TSM:UPL:FAILIs there any place where I can look up the abbreviations?
-
Hi,
ok I started the next run, I checked the voltage levels (Multimeter is showing a differential of A&B of 0.2 V and is going up during sending.
The Breadboard has no short circuit potential, the wire is now 2x2x0.3 and about 50 cm long, I added R100 to each end...
Then I copied the sketches of the rs485 stresstest posted in the forum...
But it is not working though... ;-(
Any ideas?
Thank you.This is what the node prints now:
621470 TSM:FPAR
4621471 TSM:FPAR:STATP=0
4621474 TSM:ID
4621475 TSM:ID:OK
4621477 TSM:UPL
4621488 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
4623496 TSM:UPL
4623506 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
4625513 TSM:UPL
4625523 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
4627530 TSM:UPL
4627540 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
4629548 !TSM:UPL:FAILIs there any place where I can look up the abbreviations?
-
Hi,
ok I started the next run, I checked the voltage levels (Multimeter is showing a differential of A&B of 0.2 V and is going up during sending.
The Breadboard has no short circuit potential, the wire is now 2x2x0.3 and about 50 cm long, I added R100 to each end...
Then I copied the sketches of the rs485 stresstest posted in the forum...
But it is not working though... ;-(
Any ideas?
Thank you.This is what the node prints now:
621470 TSM:FPAR
4621471 TSM:FPAR:STATP=0
4621474 TSM:ID
4621475 TSM:ID:OK
4621477 TSM:UPL
4621488 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
4623496 TSM:UPL
4623506 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
4625513 TSM:UPL
4625523 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
4627530 TSM:UPL
4627540 TSF:MSG:SEND,12-12-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
4629548 !TSM:UPL:FAILIs there any place where I can look up the abbreviations?
@kduino
We can see debug info from your node.
It is through USB port on Arduino?Because I can see:
#define MY_RS485_HWSERIAL mySerial
In your node code example.
HW serial on Arduino is connected to serial-USB converter normally.
You cannot use it for both - debug through USB and RS485 at the some time.But I think, it is mistake only, because on the start of the code you define:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(8, 9);Try delete HW serial definition.
According debug info, it seems, that your node can sending and gateway is receiving his messages,
but node do not receive messages from gateway.Or, if your communication works with direct TX-RX connection, try drivers for CAN bus instead of MAX485 ones. It eliminates possible problems with DEpin.
-
Hi Kimot,
thank you for your message. I have already built several nodes which don't have the right pinout since I didn't come across mysensors at this time. I asked here in the forum and @hek wrote, I can use SoftwareSerial as well defining it via MY_RS485_HARDWARESERIAL. It will fallback to AltSoftSerial if it doesn't work correctly...
As I mentioned I used this configuration also connecting RX-TX and TX-RX directly and it worked fine. So I assume something is wrong with the RS485 part of my setting. Unfortunately I don't have some Can driver at home.
The DE-Pins are working correctly. Each of them I connected to Led and they are flashing while sending (I assume). So there is somehow a connection, but only in one direction.
My next step is to change the input output pins on the node arduino, sometimes one have bad luck and is struggling for weeks on a problem and the simple result is one burned pin...
Thank you again I keep you updated,
kduino -
@kduino
We can see debug info from your node.
It is through USB port on Arduino?Because I can see:
#define MY_RS485_HWSERIAL mySerial
In your node code example.
HW serial on Arduino is connected to serial-USB converter normally.
You cannot use it for both - debug through USB and RS485 at the some time.But I think, it is mistake only, because on the start of the code you define:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(8, 9);Try delete HW serial definition.
According debug info, it seems, that your node can sending and gateway is receiving his messages,
but node do not receive messages from gateway.Or, if your communication works with direct TX-RX connection, try drivers for CAN bus instead of MAX485 ones. It eliminates possible problems with DEpin.
-
Hi,
Trank you all for your support. I got in running finally.
I reassembled the complete thing on the breadboard. Then I connected the wires directly (rx-tx and tx-rx). After changing the position of the inclusion of mysensors.h for some times and using the standard pins and the preset node id it worked.
Then I went further to test software serial lib which worked great. Then I extended the model to use the rs485 and after some adaptation of the wires (it's always the wires after some frustrating nights) it worked.
For understanding I integrated also two led to signaling the sending via the de pin. This helped a lot.
As this was working correctly I turned up the speed. Ok, 250.000 bps were too much, but 115.200 were running without any complaints. On a breadboard though but without any cable adaption or resistor as final terminator.
So for this topic we can conclude that if rs485 is not even running on 9600 bps on a breadboard, it's not because of the cable or the terminating resistors. In this setting it should work anyway. Unless you have no bug somewhere else....
So for all my followers again thank you very much. I can only suggest to myself to reassemble the test unit completely to rule out any wrong connections....
Bye kduino -
@hek
I used some time to get further. As my tests show I can easily use the Arduino nano on pin 8 and 9, but the strategy of using SoftwareSerial you mentioned is not working.
See what I did below. The problem is now as follows:
If I state the HW_SERIAL command before the inclusion of mysensors.h the hardware serial is somehow not initialized and therefore throws an error on compilation. Only hardware serial ports are allowed.
If I state the HW_SERIAL command after the inclusion of mysensors.h the inlcusion has no effect, thus the defined pins are not rx and tx.
Do you know any advice for that?Thank you so much for your support!
By kduino
Part of my ino file:
// Enable debug prints to serial monitor #define MY_DEBUG // Enable RS485 transport layer #define MY_RS485 // Define this to enables DE-pin management on defined pin #define MY_RS485_DE_PIN 3 // Set RS485 baud rate to use #define MY_RS485_BAUD_RATE 9600 // node Id: #define MY_NODE_ID 5 #include <SoftwareSerial.h> SoftwareSerial mySerial(4, 2); // RX, TX #include <MySensors.h> #include <Bounce2.h> // Enable this if RS485 is connected to a hardware serial port #define MY_RS485_HWSERIAL mySerial unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)Part of the error:
This line is marked yellow:
#define MY_RS485_HWSERIAL mySerial
Error description:MySTestSensorRS485_working__2017-06-20_vRS485_1:68: error: invalid initialization of reference of type 'HardwareSerial&' from expression of type 'SoftwareSerial' #define MY_RS485_HWSERIAL mySerial ^ /Users/macmuc/Documents/Arduino/libraries/MySensors-master/core/MyTransportRS485.cpp:97:24: note: in expansion of macro 'MY_RS485_HWSERIAL' HardwareSerial& _dev = MY_RS485_HWSERIAL; ^ exit status 1 invalid initialization of reference of type 'HardwareSerial&' from expression of type 'SoftwareSerial' -
Note about RS485:
I've had (non-MySensors) issues with RS485 with some setups due to the fact that while the bus is not driven (no one sends anything) it's floating and not in idle state. This makes receivers pick random garbage. To make it stable you'd need to add pullup to the A line and pulldown to the B line (hope I remember polarity right way). Those will make sure the line stays idle. With two 120R terminators (both ends) the pullup/down needs to be quite small to create enough voltage across 60R. One could calculate (I think spec says 200mV), but I've used 470..680R with 5V system. Some interface modules may have these or similar current source on board.
Termination with low speeds and short lines seems not so critical in practise.
-
Hi Kisse66,
thank you very much for this advice. Most of the forum writers are pointing on the terminating resistors, but in my experience they are not the key.
I put two 680R from B to GND and A to 5V and the reliability I experienced has improved tremendously!
Thank you for the hint.Another question I have: The gateway is receiving the messages now but there is no ACK. How can I ask for an ack for security relevant messages?
Thank you
By kduino