Serial communication failed to retreive all bytes

I am trying to use Nucleo board F401RE to communicate with sensor with serial.
The protocol is following:
sender: 0xDD,0xA5,0x03,0x00,0xFF,0xFD,0x77
senor: 0xDD 0x03 0x00 0x1B 0x12 0xD0 0x00 …

My code:

Serial device(PA_11, PA_12);
void Rx_interrupt() {
NVIC_DisableIRQ(USART6_IRQn);
while(device.readable())
{
printf(“%x\t”, device.getc());
}
NVIC_EnableIRQ(USART6_IRQn);
}
int main()
{
device.baud(9600);
device.format();
char command[7] {0xDD,0xA5,0x03,0x00,0xFF,0xFD,0x77};
device.attach(&Rx_interrupt, Serial::RxIrq);
while(1) {
for (int i = 0; i<7; i++)
device.putc(command[i]);
wait(1.0);
}
}

It can send command to the sensor but the response with:
dd 1b 00 …
but I expect: 0xDD 0x03 0x00 0x1B 0x12 0xD0 0x00
It means one hex follow by two escaped. This is very strange behavior. Can someone give hints to this issue?
If i use serial monitor software it works correct. I suppose this is bug in my code but what is the missing piece?

Hi,

Remove printf from your interrupt function. Printf takes very long time and is most probably the reason why you lost characters. Collect characters in interrupt but print them in main.

Regards,
Pekka