Serial Comm shared library sending wrong data when used with ctypes
Verfasst: Montag 25. Juni 2018, 10:03
Hello All,
I have a built a simple serial communication shared library which i am trying to use in python using the ctypes library. The steps that i am following are:
1. Load the .so file by calling ctypes.cdll.loadlibrary().
2. Initialize the serial communication module.
3. Send 0xFF as sync bytes.
When i do the above steps i am not getting only junk data at the other end. Funnily when i use the .so file in C and do the same operation it works absolutely fine. So My question is does the ctypes module manipulate the loaded library in any way? I am quite new to using C in Python and i am drawing blank here. Any suggestions would be very helpful.
Thanks in advance.
I have a built a simple serial communication shared library which i am trying to use in python using the ctypes library. The steps that i am following are:
1. Load the .so file by calling ctypes.cdll.loadlibrary().
2. Initialize the serial communication module.
3. Send 0xFF as sync bytes.
When i do the above steps i am not getting only junk data at the other end. Funnily when i use the .so file in C and do the same operation it works absolutely fine. So My question is does the ctypes module manipulate the loaded library in any way? I am quite new to using C in Python and i am drawing blank here. Any suggestions would be very helpful.
Thanks in advance.