Hi Botond ,
The Modbus Master TCP branch does not support RTU over TCP and sends the UID = 0 in the MBAP as per spec.
In order to address the slave with custom UID, you need to use the updated code of the Modbus library posted here (self-contained project):
https://github.com/alisitsyn/modbus_sup ... cp_support
The UID of the slave to be addressed is defined in the data dictionary (the field mb_parameter_descriptor_t::mb_slave_addr (SLAVE_UID_1, SLAVE_UID_2).
Code: Select all
const mb_parameter_descriptor_t device_parameters[] = {
// { CID, Param Name, Units, Modbus Slave Addr (UID), Modbus Reg Type, Reg Start, Reg Size, Instance Offset, Data Type, Data Size, Parameter Options, Access Mode}
{ CID_INP_DATA_0, STR("Data_channel_0"), STR("Volts"), SLAVE_UID_1, MB_PARAM_INPUT, 0, 2,
INPUT_OFFSET(input_data0), PARAM_TYPE_FLOAT, 4, OPTS( -10, 10, 1 ), PAR_PERMS_READ_WRITE_TRIGGER },
{ CID_HOLD_DATA_0, STR("Humidity_1"), STR("%rH"), SLAVE_UID_2, MB_PARAM_HOLDING, 0, 2,
HOLD_OFFSET(holding_data0), PARAM_TYPE_FLOAT, 4, OPTS( 0, 100, 1 ), PAR_PERMS_READ_WRITE_TRIGGER }
}
The official update will be merged later.