RS485 transmit errors
-
Hello,
I am trying to setup a RS485 gateway on a raspberry with an arduino node.
Raspberry gateway is build with
./configure --my-gateway=ethernet --my-port=8011 --my-transport=rs485 --my-rs485-serial-port=/dev/ttyAMA0 --my-rs485-de-pin=37The arduino sketch is configured with
#define MY_DEBUG #define MY_RS485 #define MY_RS485_DE_PIN 2 #define MY_RS485_BAUD_RATE 9600 #define MY_BAUD_RATE 9600 #define MY_NODE_ID 2On each RS485 I have a 120 ohm resistor. The arduino and the raspberry are very close so the wires are short
The parent request from the node to the gateway fails. I have added extra logging on each side, and I see following issue
- the parent request is received by the gateway
- but the response to the node is corrupted.
The gateway write following bytes
- 1 -> SOH
- 2 -> destination node
- 0 -> source address
- 88 -> command
- 8 -> message length
- 2 -> STX
The node receives
- 1 -> SOH
- 65534-> destination node -> ERROR
- 0 -> source address
- 65496-> command-> ERROR
- 8 -> message length
- 2 -> STX
As you can see some bits are corrupted
Expected destination node =2 (in binary 0000 0000 0000 0010), while we received 65534 (in binary 1111 1111 1111 1110). The leading bits are 1 instead of 0
Same issue about command byte.
It is 100% reproductible, this message is always received with same values so I don't think it is caused by noise or something like that.Any idea about the root cause?
-
Hello,
I am trying to setup a RS485 gateway on a raspberry with an arduino node.
Raspberry gateway is build with
./configure --my-gateway=ethernet --my-port=8011 --my-transport=rs485 --my-rs485-serial-port=/dev/ttyAMA0 --my-rs485-de-pin=37The arduino sketch is configured with
#define MY_DEBUG #define MY_RS485 #define MY_RS485_DE_PIN 2 #define MY_RS485_BAUD_RATE 9600 #define MY_BAUD_RATE 9600 #define MY_NODE_ID 2On each RS485 I have a 120 ohm resistor. The arduino and the raspberry are very close so the wires are short
The parent request from the node to the gateway fails. I have added extra logging on each side, and I see following issue
- the parent request is received by the gateway
- but the response to the node is corrupted.
The gateway write following bytes
- 1 -> SOH
- 2 -> destination node
- 0 -> source address
- 88 -> command
- 8 -> message length
- 2 -> STX
The node receives
- 1 -> SOH
- 65534-> destination node -> ERROR
- 0 -> source address
- 65496-> command-> ERROR
- 8 -> message length
- 2 -> STX
As you can see some bits are corrupted
Expected destination node =2 (in binary 0000 0000 0000 0010), while we received 65534 (in binary 1111 1111 1111 1110). The leading bits are 1 instead of 0
Same issue about command byte.
It is 100% reproductible, this message is always received with same values so I don't think it is caused by noise or something like that.Any idea about the root cause?
@sebastieng too much load ? one 120ohm on the far one should be enough
-
FYI, I have found my error
The description of my setup was not totally correct, I don't use an arduino but a atmega328p standalone.
The root cause was the use of the internal oscillator, it is not enough accurate. I am now using an external quarz and it is working fine -
FYI, I have found my error
The description of my setup was not totally correct, I don't use an arduino but a atmega328p standalone.
The root cause was the use of the internal oscillator, it is not enough accurate. I am now using an external quarz and it is working fine@sebastieng Thanks for letting us and future readers know.
-OSD
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login