modbus issue while reading
Posted: Tue Jun 02, 2020 6:53 am
HI,
I am using master functionality with modbus slave device. Current program has strange issue and this appear with no consistency.
Sometime this happens after hour or 5hrs, 24hrs or 40hrs.
I have two registers to read/write. I receive command (example : 3:3:3:1:0 slaveid:fcode:address:length:value) from MQTT message for read or write operations. Based on the message, my program do required.
Until i get below error, everything works flawless.
When I try to read/write data to modbus slave, I get the following error.
MB_CONTROLLER_MASTER: mbc_master_send_request(131): SERIAL master send request failure error=(0x108) (ESP_ERR_INVALID_RESPONSE).
once the above error appear, the next requests read data is interchanged.
Example, before this error
3:3:3:1:0 response is 260
3:3:1:1:0 response is 1
after the above error occured,
3:3:3:1:0 response is 1 or 260
3:3:1:1:0 response is 260 or 1
I tried to restart my modbus slave, did not help.
I tried with modbus simulator, did not help.
I tried to do soft restart when this error occurs, did not help.
only way its working again was hard power restart.
My setup is
esp32 tx/rx <-> rx/tx RS485 TTL a/b -> a/b Modbus Slave
Any suggestions are really helpful.
Thanks,
Surendra
I am using master functionality with modbus slave device. Current program has strange issue and this appear with no consistency.
Sometime this happens after hour or 5hrs, 24hrs or 40hrs.
I have two registers to read/write. I receive command (example : 3:3:3:1:0 slaveid:fcode:address:length:value) from MQTT message for read or write operations. Based on the message, my program do required.
Until i get below error, everything works flawless.
When I try to read/write data to modbus slave, I get the following error.
MB_CONTROLLER_MASTER: mbc_master_send_request(131): SERIAL master send request failure error=(0x108) (ESP_ERR_INVALID_RESPONSE).
once the above error appear, the next requests read data is interchanged.
Example, before this error
3:3:3:1:0 response is 260
3:3:1:1:0 response is 1
after the above error occured,
3:3:3:1:0 response is 1 or 260
3:3:1:1:0 response is 260 or 1
I tried to restart my modbus slave, did not help.
I tried with modbus simulator, did not help.
I tried to do soft restart when this error occurs, did not help.
only way its working again was hard power restart.
My setup is
esp32 tx/rx <-> rx/tx RS485 TTL a/b -> a/b Modbus Slave
Any suggestions are really helpful.
Thanks,
Surendra