Help Needed: Modbus Communication Failing on TRB245 with RS-485 Half-Duplex Setup

Hello,

I’m working on integrating a Modbus RTU device with the Teltonika TRB245 using the RS-485 half-duplex interface. Despite setting everything up according to the manual, I keep encountering “failed request” errors when trying to query registers on the connected device.

Here’s an overview of my setup:

  1. Physical Wiring:
  • RS-485 D+ and D- lines from the device are connected to the TRB245’s A and B terminals, respectively.
  1. TRB245 Configuration:
  • Serial interface is set to RS-485 half-duplex.
  • Baud rate, parity, and stop bits are matched with the device’s settings.
  • Modbus Client is configured with the correct Slave ID, register address, and function code (03 - Read Holding Registers).
  1. The Issue:
  • Any query sent via the TRB245’s Modbus Client results in a “failed request” error.
  • Logs indicate no response from the device.

Steps I’ve already tried:

  • Verified wiring and swapped D+ and D- as a precaution.
  • Tested with increased timeout and multiple retries in the TRB245 Modbus settings.
  • Used an RS-485 to USB adapter with Modbus Poll software on a PC, which successfully communicated with the device using the same parameters.

It seems the issue might be specific to the TRB245 configuration or compatibility with this device. Has anyone else encountered a similar issue or successfully used the TRB245 for Modbus communication in a half-duplex RS-485 setup?

Any guidance or suggestions would be greatly appreciated!

Thanks in advance.



Hello,

Thank you for reaching out.

The first thing to check in your setup is the wiring. Ensure that the R+ and D+ terminals are connected (shortened) and the R- and D- terminals are also connected (shortened), as shown in the wiring example below:

If you need further assistance or have additional questions, feel free to reach out.

Best regards,

1 Like

Hi Martynas,
I appreciate the reply,

unfortunately I still am receiving the “failed request” error after wiring up as recommended. - This maybe a configuration problem but I cannot see one.

When setting up the Modbus Serial Client (as I need to be able to read certain holding registers of my sensor)
NOTE:
The client signals as up.
The device also signals as up.




A Question
RE: modbus → mqtt
is it possible to pass modbus communication to mqtt then to a third party with the trb245?

I am knew to networking and IoT so please forgive my not fully understanding!

Kind regards,
Joshua.

Hello Joshua,

For testing purposes, could you try the following:

  • Change Period and Timeout values to their default settings (e.g., Period: 60 seconds, Timeout: 1 second).
  • Ensure that the data type matches the requirements specified in your server device’s manual.
  • Try adjusting the baud rate to common values such as 9600 or 115200.

If the issue persists, performing a factory reset and setting up the configuration from scratch might help eliminate any misconfigurations.

Regarding your question about Modbus to MQTT:
Yes, it’s possible to send Modbus data to an MQTT broker using the Modbus serial client MQTT gateway functionality on the TRB245. A detailed configuration example can be found in this guide: Modbus RTU Client MQTT Serial Gateway

Feel free to reach out if you have further questions or need additional assistance.

Kind regards,

Hi Martynas,
Thank you again for your help,

I have made all the suggested changes, including a factory reset and unfortunately the problem still persists.

One thing of note is, (which may or may not be relevant) that the failed request counter is not always consistent in the time of when the first failed request is registered.
For example, with the settings I sent you yesterday I received the first failed request after 3 seconds.
After adjusting the period to the default 60 seconds and timeout to 1 second, I receive a failed request immediately - meaning not even 1 second.

Re MQTT set up you have sent me,
Is the same setup possible with just one trb245 gateway?

Thank you in advance,

Kind regards,
Joshua Moir

Hello,

Thank you for the update and additional details.

Could you let me know which firmware version is currently installed on your TRB245?

Regarding the inconsistent Failed requests counter, it is not directly tied to the issue. The counter updates only after the specified Period parameter. However, the error message “failed to test request, check your configuration” is often related to wiring issues, so I would not dismiss the possibility of incorrect wiring being the root cause.

Could you provide a picture of how your wiring looks? This would help confirm if there’s any potential misconnection or fault in the setup.

As for your question, yes, the same Modbus RTU client to MQTT serial gateway setup is possible using only the TRB245 as the Modbus Serial Client, with your sensor device acting as the server (slave).

Kind regards,

Hi Martynas,

Happy new year, I hope you managed to get a break at some point over the holiday period!

Just looking for a bit more clarification on the set up of the TRB245,

I have wired it up as suggested, which was a great help and solved the previous issues!

I basically just need another point/push in the right direction if possible.

As previously mentioned, I have connected the trb245 via serial connection to a sensor that measures various conditions e.g temperature and pressure.
with the goal of sending the conditions via mqtt to a broker and be used in prediction models.

I currently have a modbus tcp server → modbus tcp client set up (see screenshots), am I right in thinking this configuration is not able to monitor the sensor via serial and only able to monitor the trb245 itself - the reason I believe is is because when accessing the modbus registers of the sensor (5th register for a total of two registers, which should give me temperature)I get a return of [0.000, 0.000] but if I access the registers of the trb245 I receive a return of expected results e,g the name of the of teltonika device.

I am assuming I have to set up a Modbus Serial Server and Modbus serial client to have access to the sensor connected via serial - is this the correct assumption?

or am I totally off track?

Please feel free to reach out for clarifying questions,
Thanks again for the support!





Hello,

Happy New Year!

Regarding your setup with the TRB245, you’re absolutely correct in identifying the issue with the current configuration. Right now, you’ve enabled the Modbus TCP Server on the TRB245 itself (as per your first screenshot), which is why you’re receiving inappropriate register values This setup essentially allows you to read registers from the TRB245, not the sensor connected via the serial interface.

To access data from your sensor connected via serial, you only need to configure the Modbus Serial Client. Here’s how to set it up:

Steps to Configure Modbus Serial Client:

  1. Disable Modbus TCP Server/Client:
    Navigate to Services → Modbus and disable the current Modbus TCP Server/Client to avoid conflicts.
  2. Set Up Modbus Serial Client:
  • Go to Services → Modbus → Modbus Serial Client and create a new Serial Device instance.
  • Set the Interface to RS485 (or the correct one based on your sensor’s communication method).
  • Configure the parameters (baud rate, parity, data bits, stop bits, etc.) to match your sensor’s settings.
  • Press Save & Apply.
  1. Add a Modbus Device Instance:
  • Add a new Modbus Device and assign it to the Modbus Serial Client instance you just created.
  • Configure the device settings, such as the sensor’s Modbus address.
  1. Create a Request:
  • Add a request to query the specific registers of your sensor.
  • Test the configuration to ensure you’re receiving the expected data (e.g., temperature, pressure, etc.).

Sending Data to MQTT Broker:

Once the data is correctly parsed from the sensor, you can send it to your MQTT broker. We have a similar Modbus RTU Client (Master) MQTT Serial Gateway wiki configuration example that might be useful available here.

Feel free to reach out if you have any additional questions or need further clarification.

Best regards,

1 Like

Hi Martynas,

Thanks you again for the reply and instructions.

I have set up the client as instructed and am unfortunately receiving an error - “failed to test, check your configuration”

The sensor configuration is:
follows: Serial mode : MODBUS
Baud P D S : 19200 E 8 1
Output interval: 2 S
Serial delay : 0
Address : 4

The attached screenshots show the configuration of the TRB245:




can you see any clear errors in my configuration?

Kind regards Joshua

Hello Joshua,

Thank you for sharing more details.

For testing purposes, I suggest the following adjustments:

  1. Change the Period: Set it to the default value (60).
  2. Adjust the Baud Rate: Try testing with other common baud rates such as 9600 or 115200.
  3. Verify Data Parsing and Function: Ensure that the data parsing type and function are configured correctly according to your sensor’s documentation.

If the issue persists after these steps, performing a factory reset (if possible) might be worth giving it a try.

Should you require further assistance, please don’t hesitate to reach out.

Kind regards,