ModbusMaster icon indicating copy to clipboard operation
ModbusMaster copied to clipboard

RTU Request sometimes sent with leading eight 0x00 words

Open BastianGschrey opened this issue 8 years ago • 0 comments

ModbusMaster version

2.0.1

Arduino IDE version

1.8.1

Arduino Hardware

DUE

Platform Details

Windows 10 x64


Scenario:

Communiction with a CAR ecu that talks modbus. It's working, the problem is that I get malformed requests sometimes

Steps to Reproduce:

This is my code:

void readModbusRegister()
{

  ecu.readHoldingRegisters(4097, 6); //read 6 registers beginning from offest 4097

  if (result == ecu.ku8MBSuccess)  //if transmission is good, decode Data
  {
    decodeModbusRegister();

  }

}


void decodeModbusRegister()  //read  word registers and write into data array
{

  for (j = 0; j < 6; j++)
  {
    data[j] = ecu.getResponseBuffer(j);
  }

  printValues(); //after decoding, print data
}

Expected Result:

Request is sent for 6 registers.

Actual Result:

Its working but sometimes the request packets are malformed:

 01 03 10 01 00 06 90 C8  <--- Good request
 01 03 10 01 00 06 90 C8  <--- Good request
 01 03 10 01 00 06 90 C8  <--- Good request
00 00 00 00 00 00 00 00 01 03 10 01 00 06 90 C8   <--- malformed request

BastianGschrey avatar Feb 05 '17 12:02 BastianGschrey