Connect UNO to DUE via USB. Reading is not working as it should

Hello,

I’m trying to connect another arduino via USB, here is my source code

//USBHost 1.0.3
#include <Usb.h>

USBHost usb;
EpInfo ep[2];

byte buf[ 1024 ];

void setup() {

  Serial.begin(115200);

  while ( usb.getUsbTaskState() != USB_STATE_RUNNING )
  {
    usb.Task();
  }

  if (!usb.ctrlReq(1, 0, 0x00, SET_CONFIGURATION, 1, 0, 0, 0, 0, ( byte *)&buf, NULL))
    Serial.println("SET_CONFIGURATION: 1");

  if (!usb.ctrlReq(1, 0, 0x21, 0x22, 3, 0, 0, 0, 0, ( byte *)&buf, NULL))
    Serial.println("SET_CONTROL_LINE_STATE: DTR=1 RTS=1");
  
  buf[0] = 0x80; //0x2580=9600
  buf[1] = 0x25;
  buf[2] = 0x00;
  buf[3] = 0x00;
  buf[4] = 0x00;
  buf[5] = 0x00;
  buf[6] = 0x08; //8 bit
  if (!usb.ctrlReq(1, 0, 0x21,  0x20, 0, 0, 0, 7, 7, ( byte *)&buf, NULL))
    Serial.println("SET_LINE_CODING: 9600/8bit");

  //configuring endpoints
  ep[0].deviceEpNum	= 0x04;
  ep[0].hostPipeNum	= UHD_Pipe_Alloc(1, 0x04, UOTGHS_HSTPIPCFG_PTYPE_BLK, UOTGHS_HSTPIPCFG_PTOKEN_OUT, 40, 0, UOTGHS_HSTPIPCFG_PBK_1_BANK);
  ep[0].maxPktSize	= 40;
  ep[0].epAttribs	= 0x02;
  ep[1].deviceEpNum	= 0x83;
  ep[1].hostPipeNum	= UHD_Pipe_Alloc(1, 0x83, UOTGHS_HSTPIPCFG_PTYPE_BLK, UOTGHS_HSTPIPCFG_PTOKEN_IN, 40, 0, UOTGHS_HSTPIPCFG_PBK_1_BANK);
  ep[1].maxPktSize	= 40;
  ep[1].epAttribs	= 0x02;
  ep[1].bmNakPower  	= USB_NAK_NOWAIT;
  if(!usb.setEpInfoEntry(1, 2, ep))
    Serial.println("setEpInfoEntry: ok");

  //try to send
  buf[0] = 'x';
  buf[1] = '.';
  if(!usb.outTransfer(1, 0x04, 2, ( byte *)&buf))
    Serial.println( "outTransfer: ok" );
}


void loop() {
  usb.Task();
  if ( usb.getUsbTaskState() == USB_STATE_RUNNING) {  
    
    uint32_t n = 40;
    byte rcode = usb.inTransfer(1, 0x83, &n, ( byte *)&buf);  
    
    if (rcode == 0 && n > 0) {      
      Serial.print(millis());
      Serial.print(": ");
      for (int i = 0; i < n; i++)
        Serial.write(buf[i]);
      Serial.println();        
    }else 
    if (rcode == 0xFF) {
      Serial.print(millis());
      Serial.println(": timeout");
    }else{
      Serial.print(millis());
      Serial.print(": code=");
      Serial.println(rcode);
    }     
  }  
}

It almost works correctly, but the input stream is blocked (waiting for something), not asynchronous. I think I did not properly adjust the endpoint/pipe. Can anyone suggest what the problem is?
Connected Uno send every 2 seconds “ABCDEF” string to Serial and this is what is displayed in the process:

SET_CONFIGURATION: 1
SET_CONTROL_LINE_STATE: DTR=1 RTS=1
SET_LINE_CODING: 9600/8bit
setEpInfoEntry: ok
outTransfer: ok
434: code=1
436: code=1
438: code=1
....
1032: code=1
1034: code=1
1037: AB
6038: timeout
6038: CDEF
11038: timeout
11038: ABC
16038: timeout
16038: ABCD
21038: timeout
21038: AB
26038: timeout
26038: ABCD
...

And here is device description:

Device Descriptor:
Descriptor Length:	22
Descriptor type:	1
USB version:		110
Device class:		2
Device Subclass:	0
Device Protocol:	0
Max.packet size:	10
Vendor  ID:		2341
Product ID:		43
Revision ID:		1
Mfg.string index:	1
Prod.string index:	2
Serial number index:	334
Number of conf.:	1

Configuration Descriptor:
Length:			9
Descriptor Type:	2
Total length:		3E
Num.intf:		2
Conf.value:		1
Conf.string:		0
Attr.:			300
Max.pwr:		100 mA

Interface Descriptor:
Intf.number:		0
Alt.:			0
Endpoints:		1
Class:			2
Subclass:		2
Protocol:		1
Intf.string:		0

Endpoint Descriptor:
Endpoint address:	202
Attr.:			3
Max.pkt size:		8
Polling interval:	377


Interface Descriptor:
Intf.number:		1
Alt.:			0
Endpoints:		2
Class:			12
Subclass:		0
Protocol:		0
Intf.string:		0

Endpoint Descriptor:
Endpoint address:	4
Attr.:			2
Max.pkt size:		40
Polling interval:	1

Endpoint Descriptor:
Endpoint address:	203
Attr.:			2
Max.pkt size:		40
Polling interval:	1