Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Modbus RTU 485

adc1994
2014-11-13
2020-02-02
  • adc1994 - 2014-11-13

    Hi everybody,
    i am working on a MODBUS RTU over rs485 line system; the master device is my Raspberry PI, and the slave is an Arduino UNO with the simple-modbus-slave firmware.
    I am going crazy trying to get this to work, i have tried everything: the MODBUS slave device on codesys shows the "Not running" error, while the arduino "rx" and "tx" pins are enabled and blinking, showing the master's request, followed by the slave's response.
    Any ideas?
    Thanks in advance.

     
  • eschwellinger

    eschwellinger - 2014-11-13

    Hi,

    you mean you have configured / mapped your serial port in that way that codesys could use it?
    The only point seems that the master does not recognize the slave reposonse in the watch window (see my screenshot)?

    BR
    Edwin

    IMG: ModbusResponse.jpg

     
  • adc1994 - 2014-11-13

    These are my screens.
    Thanks in advance

    IMG: Schermata 2014

    IMG: Schermata 2014

     
  • eschwellinger

    eschwellinger - 2014-11-13

    type:

    Modbus_Slave_COM_Port

    to the watch window...
    BR
    Edwin

     
  • adc1994 - 2014-11-13

    Done.
    It seems like a wrong response comes from the slave...

    IMG: Schermata 2014

     
  • eschwellinger

    eschwellinger - 2014-11-13

    Hi,

    look like CODESYS get data from the wrong slave (at lease think it gets the wrong data)
    does your address fit to your slave?

    BR
    Edwin

    IMG: SlaveAdress.jpg

     
  • adc1994 - 2014-11-13

    Yes. The Arduino's slave id is 2 , and the slave id set in codesys is 2.
    And the rx and tx leds on the slave flash correctly.

     
  • eschwellinger

    eschwellinger - 2014-11-13

    Hi,
    is it possible to trace somehow the serial traffic?

    BR
    Edwin

     
  • adc1994 - 2014-11-16

    Everything works like a charm now.
    I set parity to 8 data bits, EVEN, 1 stop bit.

    It works both on a prolific usb-ttl + max485 converter/transceiver, and on the raspicomm board.
    I am polling data @20ms interval.

    Thanks for your help.

     
  • BlackDog17 - 2020-02-02

    adc1994 hat geschrieben:
    Everything works like a charm now.
    I set parity to data bits, , stop bit.
    It works both on a prolific usb-ttl + max485 converter/transceiver, and on the raspicomm board.
    I am polling data @20ms interval.
    Thanks for your help.

    Hi, I have a similar problem
    What arduino did you use? I use Nano
    Could you post your code for arduino please?

    Big thanks

     

Log in to post a comment.