Serial.read with CR/LF

I have a simple serial command processor that gets ASCII commands terminated with a CR/LF.
I am finding that Serial.read does not return in certain circumstances.
I wrote the following test code:

        if (Serial.available() == true)
        {
            buff[index++] = Serial.read();
            Serial.printf( "<%u>", buff[ index - 1 ] );
	}

Whenever I hit a key in my serial terminal, I see it appear with its ASCII code. If I enter CR I get <13> and if I send LF I get <10> but if I set my terminal to transmit CR+LF on hitting the enter key I get nothing and my serial command read routine locks up. I suspect it is now stuck in read for some reason !

What am I missing?

Andy

And how did you do that?

@maxgerhardt

How did I do what?
How did I send CR+LF?

image

Andy

TeraTerm’s behavior might be weird. When you set

monitor_eol = CRLF

in the platformio.ini and use the project task “monitor”, do you get the same behavior?

@maxgerhardt

This is what my platformio.ini currently looks like:

[base_config]
platform = espressif32@3.4
framework = arduino
monitor_speed = 115200
monitor_flags = 
	--eol=CRLF
	--echo
	--filter=esp32_exception_decoder
lib_deps =

Thanks for your interest.

Andy