Python Forum

Full Version: Retrieve data from oscilloscope using pyserial on ubuntu
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi i am trying to retrieve data from an oscilloscope, it works well with windows using the provided software but i need to use it with ubuntu using the raw data directly. For the moment i came up with:
import serial
from serial import Serial

ser = serial.Serial('/dev/ttyACM0',115200, timeout=0)
print ser.name

packet = bytearray()
packet.append(<byte1>)
packet.append(<byte2>)
packet.append(<byte3>)
packet.append(<byte4>)

ser.write(packet)
print packet 
while ser.in_waiting:
	data=ser.read()
	print data
	print '\n'	
ser.close()
but the while loop is not performed, and also how to set parameters like ReadIntervalTimeout, ReadTotalTimeoutMultiplier specific to win32 serial or is there a more suitable library than pyserial. I am sure about the <bytei> values, i figured them using a serial port sniffer.

Best regards.
can you supply make and model of the oscilloscope so that we can download user manual.
Well

to be totally honest i've been openly told i couldn't benefit from any support relative to that subject, which I think is preposterous, so i cant really disclose more information regarding makes, models
All i have left then is the requests displayed by the serial port sniffer, which consists in setting timeout parameters in a certain way and sending 4 specific bytes to initiate the transfer. FYI i was able to make it work on windows setting the same parameters and using win32 serial api. I apologize next lines are not python but they are still code

cout << "Set params OK" << endl;
    //Setting Timeouts
    timeouts.ReadIntervalTimeout = 10;
    timeouts.ReadTotalTimeoutMultiplier = 0;
    timeouts.ReadTotalTimeoutConstant = 10;
    timeouts.WriteTotalTimeoutMultiplier = 0;
    timeouts.WriteTotalTimeoutConstant = 50;

    if (SetCommTimeouts(hComm, &timeouts) == FALSE)
    {
        printf_s("\nError to Setting Time outs");
        CloseHandle(hComm);//Closing the Serial Port
    }

    cout << "Set timeouts OK" << endl
Best regards.
Hi

In the end it wasn't a pyserial related issue.
After having reverse engineered the scope I got it to work, i wasnt sending the right byte sequence.

Best regards