@msmacs
Thanks a lot. This is it.
I tried pins 10, 11, 12 (RX / TX / DE-RE) and it worked.
Problem solved.
Posts made by PawelD
-
RE: RS485 & SoftwareSerial
-
RE: RS485 & SoftwareSerial
@kimot
I rejected AltSoftSerial library because:- My shields operate on pins 0 to 5. AltSoftSerial has fixed pins 8,9 for Uno and 46,48 for Mega.
- I want to keep pins 0 and 1 for debug/controller communication
- I want to use two RS485 shields on my Mega: one using pins 2,3, and second pins 4,5.
Here you can see the setup I'm talking about:
Zihatec RS485 Multiple busses -
RE: RS485 & SoftwareSerial
@mfalkvidd
I tried removing "define MY_RS485_HWSERIAL" but it didn't help.
My code compiles correctly, but there is no communication.
Hardware setup is identical for both examples, except for the rx/tx pins used.
This is very simple setup: a button connected to Nano+Max485 module, and Mega+Max485 gateway, connected via RS485.@kimot
I have node_id assigned in my Nano node's code. -
RS485 & SoftwareSerial
Re: How to use SoftwareSerial Library?
Hi.
Anyone managed to run SoftwareSerial on RS485 gateway?
I tried to do everything according to what is said in the link above, but with no success.This works (using hardware serial1 of my Mega):
#define MY_RS485 #define MY_RS485_DE_PIN 3 #define MY_RS485_BAUD_RATE 9600 #define MY_RS485_HWSERIAL Serial1 #define MY_GATEWAY_SERIAL #include <MySensors.h> void setup(){} void presentation(){} void loop(){}
and this one doesn't work (trying to use SoftwareSerial pins 4 and 2)
#define MY_RS485 #define MY_RS485_DE_PIN 3 #define MY_RS485_BAUD_RATE 9600 #include <SoftwareSerial.h> SoftwareSerial mySerial(4,2); //rx, tx #define MY_RS485_HWSERIAL #define MY_RS485_SWSERIAL mySerial #define MY_GATEWAY_SERIAL #include <MySensors.h> void setup(){} void presentation(){} void loop(){}
I also made a change in MyTransportRS485.cpp
before:
#if defined(__linux__) SerialPort _dev = SerialPort(MY_RS485_HWSERIAL); #elif defined(MY_RS485_HWSERIAL) HardwareSerial& _dev = MY_RS485_HWSERIAL; #else AltSoftSerial _dev; #endif
and after:
#if defined(MY_RS485_SWSERIAL) SoftwareSerial& _dev = MY_RS485_SWSERIAL; #elif defined(__linux__) SerialPort _dev = SerialPort(MY_RS485_HWSERIAL); #elif defined(MY_RS485_HWSERIAL) HardwareSerial& _dev = MY_RS485_HWSERIAL; #else AltSoftSerial _dev; #endif
What am I doing wrong?
I'm using MySensors 2.3.1 library.