rpi 3 ethernet gateway to serial rs485



  • Hi

    I have set up my rpi 3 b+ with raspbian lite to the following page.

    https://forum.mysensors.org/topic/6960/raspberry-pi-3-as-gateway-using-rs485

    ./configure --my-rs485-serial-port=/dev/serial0 --my-gateway=ethernet --my-port=5003 --my-transport=rs485 --my-rs485-baudrate=9600 --my-rs485-de-pin=37 --my-leds-err-pin=12 --my-leds-rx-pin=16 --my-leds-tx-pin=18
    
    pi@raspberrypi:~/MySensors $ sudo ./configure
    [SECTION] Detecting target machine.
      [OK] machine detected: SoC=BCM2837, Type=rpi3, CPU=armv7l.
    [SECTION] Detecting SPI driver.
      [OK] SPI driver detected:BCM.
    [SECTION] Gateway configuration.
      [OK] Type: ethernet.
      [OK] Transport: rs485.
      [OK] Signing: Disabled.
      [OK] Encryption: Disabled.
    [SECTION] Detecting init system.
      [OK] Init system detected: systemd.
    [SECTION] Saving configuration.
      [OK] Saved.
    [SECTION] Cleaning previous builds.
      [OK] Finished.
    pi@raspberrypi:~/MySensors $
    

    When i run the code i get

    pi@raspberrypi:~/MySensors $ sudo ./bin/mysgw
    Sep 23 03:33:43 INFO  Starting gateway...
    Sep 23 03:33:43 INFO  Protocol version - 2.3.0
    Sep 23 03:33:43 DEBUG MCO:BGN:INIT GW,CP=RSNGL---,VER=2.3.0
    Sep 23 03:33:43 DEBUG TSF:LRT:OK
    Sep 23 03:33:43 DEBUG TSM:INIT
    Sep 23 03:33:43 DEBUG TSF:WUR:MS=0
    Sep 23 03:33:43 DEBUG Serial port /dev/serial0 (9600 baud) created
    Sep 23 03:33:43 DEBUG TSM:INIT:TSP OK
    Sep 23 03:33:43 DEBUG TSM:INIT:GW MODE
    Sep 23 03:33:43 DEBUG TSM:READY:ID=0,PAR=0,DIS=0
    Sep 23 03:33:43 DEBUG MCO:REG:NOT NEEDED
    Sep 23 03:33:43 DEBUG Listening for connections on 0.0.0.0:5003
    Sep 23 03:33:43 DEBUG MCO:BGN:STP
    Sep 23 03:33:43 DEBUG MCO:BGN:INIT OK,TSP=1
    

    then i use cas modbus scanner to send a command

    then i get

    Sep 23 03:33:51 DEBUG New connection from 192.168.6.66
    Sep 23 03:33:51 DEBUG GWT:TSA:C=0,CONNECTED
    

    But nothing else happens. I then manually disconnect CMS

    Sep 23 05:25:11 DEBUG GWT:TSA:C=0,DISCONNECTED
    Sep 23 05:25:11 DEBUG Ethernet client disconnected.
    

    When i do a write command CMS says it was successful but it didn't send command to my device.

    When i write a read holding register command it replies with unknown error.

    Can anyone point me to where this is not working correctly.


  • Mod

    Welcome to the MySensors forum @trentbliss

    Could you explain what CMS is in this context?

    What is a read holding register command?


Log in to reply
 

Suggested Topics

  • 87
  • 1
  • 5
  • 7
  • 2
  • 5

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts