Search code examples
serial-portdriverpyserial

How to synchronize a byte sent to the TXD line with the DTR signal in Python


I would like to perfectly synchronize each byte sent to the TXD line of my native RS232 port with a high level of the DTR line in Python. I know my RS232 can do it because I have a compiled software which succeeds to do it very precisely each time (see picture attached). Bits are sent at 9600 baud, so DTR signal must be high during 1ms (10 bits sent for 1 data byte).

I currently succeed to enable and disable DTR signal by software with the setDTR() function of the pyserial library but it is not accurate and I often lost answers of my DCE after sending a TXD byte. I need to find how to configure my com port with Python to automatically do it at a lower level (driver level I guess).

Maybe someone can help me ?

Thanks for reading me.

TXD_DTR_synchronization


Solution

  • I've finally succeeded to make an accurate control of the DTR line on Windows. I use the micros() function of this library :

    GS_timing