ModubusMaster and Arduino DUE

Hi, I have problem with using serial on DUE. On UNO is code fast and without problems. On DUE works Tx, but on Rx is result timeout error. Serial1(2,3) on DUE didn’t work at all. It sends nothing. I tried:

ModbusMaster node(Serial1,1);

and

ModbusMaster node(1,1);

Comunication not working.

If I use:

ModbusMaster node(0,1);

Code woks for UNO.

I using library version 0.11.0, arduino IDE 1.6.8

Only corrections I made, is adding lines for TX enable (line 756 and 769) and
MBSerial->begin(u16BaudRate, SERIAL_8E1) (line 149).

Code works on UNO without any problems.

My test code for due:

struct temperatureStruct {
unsigned int teplota;
};

temperatureStruct tc;

#include <ModbusMaster.h>

ModbusMaster node(1,1);

void setup()
{
  // initialize Modbus communication baud rate
  //SerialUSB.begin(9600);
  node.begin(9600);
  pinMode(3, OUTPUT);
}

void loop() {
  unsigned int result;
  result = node.readHoldingRegisters(1, 1);
  if (result == node.ku8MBSuccess) {
    tc.teplota = node.getResponseBuffer(0);}

  if (tc.teplota == 3) {node.writeSingleRegister(2, 4);}
  else
  {node.writeSingleRegister(2, 5);}

}

ModbusMaster.cpp (25.6 KB)