Serial Data Read

Hello together,

I have problems reading data on RX1 and printing it on the serial monitor, because it seems that it is not possible to receive data with the following code, but I don’t know why, because it seems to be correct. In addition I have an Oscilloscope on the RX1 pin and there I can see the receiving data. I send a command (Serial1.write()) which whom I request the slave to read out a specific register of this device, that means directly after sending the data to the device, it will response with the content of the register, the time after sending the request and receving the first data bit is approximately 500µs. From my side it is not possible to extend the time (only changing baud rate) when the device starts to answer, is the timing too fast for receiving the data?

Here is part of the code:

start();
Serial1.begin(BAUDRATE);
Serial.begin(BAUDRATE);
Serial1.write(0x55); //SYNC
Serial1.write(0xCF); //PID
Serial1.write(0x55);

//Serial.begin(BAUDRATE, SERIAL_8N1);
if (Serial1.available() > 0) {
// read the incoming byte:
rx = Serial1.read();

Serial.print("received: ");
Serial.println(rx, DEC);
}

Serial.print("received: ");
Serial.println(rx, HEX);

Right now, I have no idea why it doesn’t work, the only answer is 0 with the serial.print at the bottom (last two code lines), because rx is initialised with 0. Does anyone of has any help for me? Thank you in advance.

This can’t be your whole sketch. Where is setup()?

What are you feeding into the serial console? Did you type in some things and press ?