Modbus CRC Error after Update TRB245

Hey,

i set up a ESP32 via RS485 Modbus to let the TRB245 poll data from it.
I could swear that it worked fine until i ran the latest update to Firmware TRB2_R_00.07.05.4
On the same Bus is a other Modbus-Device (Energy meter) which still works fine, but no data is read from the ESP32 anymore.

To debug the issue further i tried to read Data using ubus command in CLI:

ubus call modbus_client serial.test '{"id":2,"timeout":1,"function":4,"first_reg":311,"reg_count":"1","data_type":"16bit_int_hi_first","no_brackets":0,"serial_type":"/dev/rs485","baudrate":9600,"databits":8,"stopbits":1,"parity":"None","
flowctrl":"None"}'
{
	"error": -1,
	"result": "Failed to get response: Invalid CRC"
}

There were no changes in the Code for generating the CRC in my ESP-Device.
Is there any way to get the full messages in HEX send and recieved my the ubus-Command?

Thanks in advance for any tips.

Hi,

I have tried recreating your connections like the topology below where I configured another router, RUT955, that will work like Modbus-Device. My TRB245 will pull out Modbus Data like Uptime and Temperature.

image

Please see below the Modbus Serial Client configuration.

Can you try switching off Full Duplex and let me know if you’re able to display the Modbus Data from TRB245.

Regards,
Janmiguel

Thanks for the quick reply!

But i am not trying to read data from the TRB, i am trying to read Data from my ESP32 Device.
Another Device (Energy meter) on the same Modbus is working fine at the same time.

Hi,

The configuration above is from TRB245 itself. TRB245 will act as Modbus Serial Client and ESP32 Device will act as Modbus Serial Server. So from TRB245 WebUI, go to Services → Modbus → Modbus Serial Client → Click the Pencil Icon for Modbus Serial Device Configuration → Then try to disable the Full Duplex Option. Let me know any results from your end. If still unsuccessful, can you share your actual topology to understand your case better. Thanks!

Regards,
Janmiguel

There you go. Full Duplex is off.

Bildschirmfoto 2023-12-07 um 13.39.16

root@Teltonika-TRB245:~# cat /etc/config/modbus_client

config main 'main'
	option enabled '1'

config rtu_device '1'
	option device '/dev/rs485'
	option name 'modbus'
	option flowcontrol 'none'
	option baudrate '9600'
	option stopbits '1'
	option databits '8'
	option enabled '1'
	option parity 'none'
	option full_duplex_enabled '0'

config rtu_server '3'
	option rtu_device '1'
	option enabled '1'
	option frequency 'period'
	option server_id '2'
	option skip_on_many_tmos '1'
	option name 'sensors'
	option period '30'
	option timeout '1'

config request_3 '4'
	option name 'Temp'
	option data_type '16bit_int_hi_first'
	option reg_count '1'
	option no_brackets '0'
	option function '4'
	option first_reg '201'
	option enabled '1'

config request_3 '5'
	option name 'Humi'
	option data_type '16bit_int_hi_first'
	option reg_count '1'
	option no_brackets '0'
	option function '4'
	option first_reg '205'
	option enabled '1'

config request_3 '6'
	option name 'test'
	option no_brackets '0'
	option data_type 'hex'
	option enabled '0'
	option function '1'
	option reg_count '1'
	option first_reg '1'

config request_3 '9'
	option name 'set_relais_0_off'
	option enabled '0'
	option reg_count '1'
	option no_brackets '0'
	option function '5'
	option data_type 'bool'
	option first_reg '1'

config request_3 '10'
	option name 'set_relais_0_on'
	option enabled '0'
	option reg_count '0'
	option no_brackets '0'
	option function '5'
	option data_type 'bool'
	option first_reg '1'

config request_3 '11'
	option name 'set_relais_1_off'
	option enabled '0'
	option reg_count '1'
	option no_brackets '0'
	option function '5'
	option data_type 'bool'
	option first_reg '2'

config request_3 '12'
	option name 'set_relais_1_on'
	option enabled '0'
	option reg_count '0'
	option no_brackets '0'
	option function '5'
	option data_type 'bool'
	option first_reg '2'

config rtu_server '13'
	option server_id '1'
	option rtu_device '1'
	option name 'ws100'
	option timeout '1'
	option period '60'
	option skip_on_many_tmos '1'
	option frequency 'period'
	option enabled '0'

config request_13 '14'
	option name 'current'
	option enabled '1'
	option reg_count '2'
	option no_brackets '0'
	option function '3'
	option data_type '32bit_int1234'
	option first_reg '259'

config request_13 '15'
	option name 'frequenzy'
	option enabled '1'
	option reg_count '1'
	option no_brackets '0'
	option function '3'
	option data_type '16bit_int_hi_first'
	option first_reg '267'

config request_13 '16'
	option name 'Total_active_energy'
	option enabled '1'
	option reg_count '2'
	option no_brackets '0'
	option function '3'
	option data_type '32bit_int1234'
	option first_reg '271'

config request_13 '17'
	option name 'active_power_watt'
	option enabled '1'
	option reg_count '2'
	option no_brackets '0'
	option function '3'
	option data_type '32bit_int1234'
	option first_reg '261'

config request_3 '18'
	option name 'get_config'
	option reg_count '3'
	option no_brackets '0'
	option function '4'
	option first_reg '301'
	option data_type '16bit_int_hi_first'
	option enabled '1'

config request_3 '20'
	option name 'status_relais_0'
	option reg_count '1'
	option no_brackets '0'
	option function '1'
	option data_type 'bool'
	option first_reg '1'
	option enabled '1'

config request_3 '21'
	option name 'status_relais_1'
	option reg_count '1'
	option no_brackets '0'
	option function '1'
	option data_type 'bool'
	option first_reg '2'
	option enabled '1'

config request_3 '22'
	option name 'temp_sensor'
	option reg_count '10'
	option no_brackets '0'
	option function '4'
	option data_type '16bit_int_hi_first'
	option first_reg '211'
	option enabled '1'

config request_3 '23'
	option name 'ext_sensors_count'
	option reg_count '1'
	option no_brackets '0'
	option function '4'
	option data_type '16bit_int_hi_first'
	option first_reg '311'
	option enabled '1'

Hi,

There are a few options that we can do with your case.

First. Downgrade the firmware to 7.04.5 and let me know if it can pull out data from both Modbus Meter.

Second. Only connect the ESP32 to TRB245 via RS485 and check if it is able to display Modbus Data. If not, kindly recheck its wiring, serial ID, and Baud Rate.

Let me know which works for you.

Regards,
JM

Hi!

After troubleshooting the issue further with a USB to RS485 Dongle and sniffing the Traffic on the Connection it turns out, that no data came from my ESP32 device so i replaced the RS485 Board and it worked again.
Thanks for your Support!

This topic was automatically closed after 15 days. New replies are no longer allowed.