SerialPort.Open() question...
-
I am working on a project that communicates to an embedded microprocessor through a USB/UART chip. The processor is wired so that it can be reprogrammed through the UBS/UART also. My software is able to open the serial port and communicate with the microprocessor. I open the serial port with the following parameters: Baud 115200, Data Bits: 8, Stop Bits One, Parity: None, and Handshake: None. The problem occurs when the serial port opens: the DTR line goes low momentarily, which causes the microprocessor to reset. The software to reprogram the microprocessor forces the DTR low during the reprogramming process, so we can not just disconnect the DTR line. Basically, my question is this: is there anything in the SerialPort.Open() internals, or the internals of the WinSDK functions that the Open() uses that would explain this?
-
I am working on a project that communicates to an embedded microprocessor through a USB/UART chip. The processor is wired so that it can be reprogrammed through the UBS/UART also. My software is able to open the serial port and communicate with the microprocessor. I open the serial port with the following parameters: Baud 115200, Data Bits: 8, Stop Bits One, Parity: None, and Handshake: None. The problem occurs when the serial port opens: the DTR line goes low momentarily, which causes the microprocessor to reset. The software to reprogram the microprocessor forces the DTR low during the reprogramming process, so we can not just disconnect the DTR line. Basically, my question is this: is there anything in the SerialPort.Open() internals, or the internals of the WinSDK functions that the Open() uses that would explain this?
The only thing I can think of that might be causing this behaviour is that upon ".Open()" being called, the DCB block is being set once per setting in the DCB block. If that is the case, then setting ".DtrEnabled" to true before calling ".Open()" *might* help. In any case the SerialPort class is just doing P/Invoke calls to the Win32 functions. I wrote my own serial port class in a way that demonstrates asynchronous behaviour. If you would like, you could take a copy of that to test with to see if you can cure this issue. Phil