Huawei SUN2000 Modbus TCP: Resolving Write Error 144

Daniel Price2 min read
ModbusOther ManufacturerTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

A Huawei SUN2000 KTL connection at 192.168.1.116:502 successfully reads holding register 40125 through Modbus TCP but rejects a write of 500. The returned response is Exception Response(144, 16, IllegalAddress). Isolate the address representation and supported write operation before treating this as a network or Python failure.

Interpret the Modbus exception

Evidence Engineering conclusion
Read from 40125 returns 10000 Communication and read access work for the supplied read request.
Write returns function 16 write_registers issued a write-multiple-registers request, even though the request contains one register.
Response code 144 This is the exception form of function 16: 16 + 128 = 144.
IllegalAddress The device rejected the addressed range in the context of that write request. A successful read does not prove that the identical wire-level address is accepted for function 16.

Check the register address representation

Determine whether 40125 is a logical register reference printed in the inverter documentation or the protocol address expected by the Python library. Do not change the address by assumption: confirm the documentation's address base and compare the actual read and write request frames. The evidence does not establish whether 40125 is already the correct wire-level offset.

Also confirm that the documented RW designation applies to the installed inverter variant, its current operating state, and Modbus TCP access path. The available evidence identifies the device only as SUN2000 KTL and provides no exact model or firmware, so model-specific write support cannot be inferred.

Match the supported write function

The failing call uses write_registers, which produced function 16. Check the manufacturer's register definition for the permitted write function. If the inverter specifies a single-register write, use the library operation that sends that supported function; if it specifies function 16, retain the current operation and continue investigating address mapping and access conditions.

The proposed value 500 fits in an unsigned 16-bit container, whose mathematical range is 0 through 65535. That does not establish that 500 is an allowed setting: the evidence supplies no engineering-unit scaling, writable range, password or enable requirement, or operating-state restriction.

Run a controlled verification

  1. Call connect() once and retain its result; the supplied code calls it before the condition and again inside the condition.
  2. Record the exact inverter model, firmware, unit identifier, documented address notation, allowed value range, scaling, and supported write function.
  3. Capture both requests and verify that the read and write use the intended unit identifier and protocol address.
  4. Retry with the documented write function and an allowed encoded value.
  5. Read the register back only after the write returns a normal response. Confirm the stored raw value and then apply the documented scaling.

If the corrected request still returns IllegalAddress, preserve the request and response frames for the manufacturer's official support channel. Those frames distinguish an address translation problem from model-, firmware-, or access-specific rejection.

FAQ

Why can Huawei SUN2000 register 40125 read but not write?

The read proves that communication and the supplied read request work. The write uses function 16, and the inverter rejects that addressed range with IllegalAddress; verify the address base and permitted write function.

What does Exception Response 144, 16, IllegalAddress mean?

144 is the exception response form of function 16, calculated as 16 + 128. It reports that the requested register range is illegal for that write transaction.

Is 500 valid for a Huawei SUN2000 U16 register?

500 fits in a U16 container, but that alone does not make it a permitted setting. Confirm the register's allowed range, scaling, access conditions, and supported write function for the exact inverter model and firmware.

Back to blog