bertmelis / esp32ModbusRTU

modbus RTU client for ESP32
MIT License
70 stars 44 forks source link

error: 0xe3 #47

Closed EmanueleFeola closed 3 years ago

EmanueleFeola commented 3 years ago

Hi, I sometimes receive this error: error: 0xe3 slaveId: 8 fc 0x10 address 0x27d

From the source code of the library I understand that it is a CRC problem, but I don't understand why it gets thrown. The function that generates the error is the WRITE_MULT_REGISTERS.

But if the problem is related to the CRC, shouldn't the problem appear in all write requests? I mean, I don't think the error is thrown because the code calculates the wrong CRC

bertmelis commented 3 years ago

Everything else is working fine? Are you also using other function codes? Maybe it's hardware related? (level converter, line termination, line driver...)

EmanueleFeola commented 3 years ago

Sometimes I receive these errors too...but very rarely. error: 0x0b slaveId: 3 fc 0x90 address 0x103a error: 0x10 slaveId: 8 fc 0xff address 0x27d "Are you also using other function codes?" yes, I'm using the following functions: readHoldingRegisters writeSingleHoldingRegister writeMultHoldingRegisters

"Maybe it's hardware related?" All I have of hw is a rx-tx-gnd-vcc cable connected to a electric board (connected to an electric engine)

bertmelis commented 3 years ago

"Maybe it's hardware related?" All I have of hw is a rx-tx-gnd-vcc cable connected to a electric board (connected to an electric engine)

You mean you connected the esp directly to a modbus line? Normal way is to use a line driver like shown on the readme page. Are you sure that you receive correct values when there's no error?

EmanueleFeola commented 3 years ago

Yes, I'm sure that I receive correct values, and the bytes I send are received correctly This is a photo of the cable IMG_20201019_221940866

EmanueleFeola commented 3 years ago

Solved (not related to modbus communication)