I am making a C# application that talks to a hardware device using the .NET System.IO.Ports.SerialPort interface (the device is connected to the USB port on my laptop using a serial -> USB converter) and one of the steps my application needs to do is change the baud rate from the factory default (38400) to the the one it will eventually need to be using (19200).
So I open the port using the initializer, set the port's baud rate to 38400; everything connects fine, I get coherent messages from the hardware. When I go to change the baud rate on the device to 19200, again, everything works perfectly, I get back a non-garbled message even though I didn't change the baud rate on the port (on my PC side). I feel like they should be speaking different languages at this point.
But when I manually change the port's settings after I change the device's settings (long after the port is open), I then get garbled messages, even though the baud rates should now be aligned. My question is: does .NET somehow automatically know the baud rate changed on the hardware side? Am I fundamentally misunderstanding how all this works?