Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
P

PawelD

@PawelD
About
Posts
4
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • RS485 & SoftwareSerial
    P PawelD

    @msmacs
    Thanks a lot. This is it.
    I tried pins 10, 11, 12 (RX / TX / DE-RE) and it worked.
    Problem solved.

    Development

  • RS485 & SoftwareSerial
    P PawelD

    @kimot
    I rejected AltSoftSerial library because:

    1. My shields operate on pins 0 to 5. AltSoftSerial has fixed pins 8,9 for Uno and 46,48 for Mega.
    2. I want to keep pins 0 and 1 for debug/controller communication
    3. 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

    Development

  • RS485 & SoftwareSerial
    P PawelD

    @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.

    @kduino @hek maybe you can help here?

    Development

  • RS485 & SoftwareSerial
    P PawelD

    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.

    Development
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular