RS485/RS232/Serial transport class for mysensors.org
-
30 seconds sound like a long time.. Not sure what could be wrong. I don't have any test setup here unfortunately.
-
Hmm, strange. Wonder if this PR affected the behaviour of AltSoftSerial (in a good way).
-
@hek ok. all good now - the ping pong example working. I forgot about the gateway flag.
BTW, checked to see if the GW has any issues without PR 599 but it seems it is still working OK. I have not changed the HW connections so must be some other change.
-
Is any data buffer/FIFO implemented in RS485 gateway?
My controller (fhem) is transmitting data too fast to the gateway, so some data is not transmitted on RS485.
I checked RX/TX from controller to gateway -> all data is going into gateway. But not all data goes out to my sensor node.I have only one sensor (and gateway) on RS485.
Baudrate is 19200 on RS485 and to controller.
Sensor node uses HW serial. Gateway is on NANO with AltSoftSerial. -
Is any data buffer/FIFO implemented in RS485 gateway?
My controller (fhem) is transmitting data too fast to the gateway, so some data is not transmitted on RS485.
I checked RX/TX from controller to gateway -> all data is going into gateway. But not all data goes out to my sensor node.I have only one sensor (and gateway) on RS485.
Baudrate is 19200 on RS485 and to controller.
Sensor node uses HW serial. Gateway is on NANO with AltSoftSerial.@karlheinz2000
I had no chance to look to the AltSoftSerial code, but if we are talking about hardware serial - arduino as a standard has 64 bytes buffer. I think it's possible that your gateway is not fast enough to process packets at high rate from FHEM. Also even if they are processed on time - at 19200 you may loose packets due low serial speed. It's simple no room for next packet. -
@LeoDesigner
I did a hardware update. Now sensor and gateway are arduino mega. Everything is running on 115200 hardware serial.
RS485 communication looks good. Data is going into sensor node, but does not appear in MySensors.
I tried to increase RX buffer via #define SERIAL_RX_BUFFER_SIZE 256, with no effect in functionality. Does this define works as expected? Because this buffer size number has no effect on the 'dynamic memory' usage after compiling the sketch. It shows always the same number of used bytes, independent of the RX buffer size. -
[Solved]
Initial Problem were incoming messages at sensor node during reading an image from SD card (170ms). Increase of serial RX buffer size solved the problem.Good to know:
The serial buffer size is not defined in:
c:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\HardwareSerial.h
You can change the numbers with no effect to your sketch.You have to change:
c:\Users...\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.14\cores\arduino\HardwareSerial.hThen it will work :smiley:
-
I'm curious whether it is possible to use this RS485 transport with Ethernet or MQTT gateway or Serial gateway is the only option?
For example, controller talks with MySensors Gateway over Ethernet,
MySensors Gateway talks with the Nodes over RS485.
Thanks! -
I'm trying to get my Ethernet gateway (UNO with W5100) working with RS485 transport.
While RS485 part seems to be working fine between the node and gateway, the Ethernet part seems to be dead. I suspect this is related to the fact that Ethernet shield uses pin 10 which is unusable with RS485. Am I right? Any workaround?