C Code Open Serial Port

/ Comments off
Code

Opening and closing the port to switch between read and write should not be necessary, just open the port for read/write.That's the problem! When i open the port for read/write it stops and i can't get any respons. Program savcom suceava. I don't like to close - open - close the port but only this way it works.Actually the programm communicates with controller, it sends three data packets, gets response and writes'success' in log file.

Serial Port Communication In C Language

LibraryC Code Open Serial Port

C Code Open Serial Port Cleanflight

But i have to set delay 100ms after each packet otherwise pc side misses data.All settings like port, baud rate, data to send, packets, and so on - user defined and located in ini file.