Issues with Modbus Slave with Raspberry Pi

ahuckphin
2024-07-10
2024-07-11
  • ahuckphin - 2024-07-10

    I have a DFRobot RS485 temperature & humidity sensor (SEN0438) connected to my Raspberry Pi via a USB to RS485 adapter. I am able to connect and read the sensor data when running a python code locally. However in Codesys, I encounter this error "A bus error has occurred." and "There was no response in time".

    Could this be because of Modbus Server Channel and Modbus Server Init configuration on my part?

    Admittedly I am new to Codesys. To get to this stage, I:
    1. added some lines to CODESYSControl_User.cfg
    2. added "Modbus_COM" in Codesys and set "Serial Port Configuration" under "General"
    3. added "Modbus_Master_COM_Port" in Codesys and checked transmission mode is set to "RTU"
    4. added "Modbus_Slave_COM_Port" in Codesys and checked server address is set to 1 (also set 1 in my sensor)
    5. added 1 channel and 1 init for "Modbus_Slave_COM_Port" under "Modbus Server Channel" and "Modbus Server Init"

     
  • nano - 2024-07-11

    in the codesyscontrol.cfg or codesyscontrol_user.cfg you have to declare whoch comport-ports from runtime are used.

    please tell us how the comport is called in linux an post the codesyscontrol.cfg files

    also write down here, which parameters are used in the python-script and what is parameteized in the modbus-master-comport of your codesys-application.

    mostly the errors occurs in ine of these areas

     

Log in to post a comment.