I have attached a screenshot of the serial terminal tera term for reference Post #1.You didn't say whether you were sending ASCII'2' or 0x02 as a command.
That's what I said "You will also need to insert some code between lines 2 and 3 to deal with illegitimate commands."
I believe when using terminal software like Tera Term to communicate with microcontroller through UART, it send characters as ASCII characters. The microcontroller receives these characters as ASCII characters