Skip to main content
Topic: BusPirate oscilloscope (Read 33377 times) previous topic - next topic

Re: BusPirate oscilloscope

Reply #15
Quote
Please let me know if there's anything you'd like me to change.

You may add a note that "pygame" lib is needed to run this script.

To install in Ubuntu use this command:
 [tt:]sudo apt-get install python-pygame[/tt:]

Re: BusPirate oscilloscope

Reply #16
Thanks, done.
Got a question? Please ask in the forum for the fastest answers.

Re: BusPirate oscilloscope

Reply #17
Did anyone get this to work on Windows? I'm stuck here...

Code: [Select]
IDLE 2.6.4      ==== No Subprocess ====
>>>
Entering binmode:
Traceback (most recent call last):
  File "N:BPpyBusPirateLiteoscope_v1.2.py", line 72, in <module>
    if bp.BBmode():
  File "N:BPpyBusPirateLitepyBusPirateLiteBitBang.py", line 51, in BBmode
    self.resetBP()
  File "N:BPpyBusPirateLitepyBusPirateLiteBitBang.py", line 95, in resetBP
    self.reset()
  File "N:BPpyBusPirateLitepyBusPirateLiteBitBang.py", line 61, in reset
    self.timeout(0.1)
  File "N:BPpyBusPirateLitepyBusPirateLiteBitBang.py", line 113, in timeout
    select.select([], [], [], timeout)
error: (10022, 'Ein ungxfcltiges Argument wurde angegeben')
>>>

Win7x64, pyBusPirateLite and Oszi from SVN...

Re: BusPirate oscilloscope

Reply #18
Did you try running any other scripts that uses pyBusPirateLite ?
Maybe try other Python version, I use 2.6.5

Re: BusPirate oscilloscope

Reply #19
I will try one of the other Scripts later!

If that also fails, i'll try another Python... Still on 2.6.4 over here ;)

Re: BusPirate oscilloscope

Reply #20
Help me

[glow=red,2,300]/Escritorio/the-bus-pirate-read-only/scripts/oscilloscope$ python oscope_v1.2.py
Entering binmode:  OK.
Traceback (most recent call last):
  File "oscope_v1.2.py", line 117, in
    voltage = voltage + ord(hex(measure[1]))
IndexError: string index out of range
[/glow]

Re: BusPirate oscilloscope

Reply #21
Hi humberto121 - what version of the Bus Pirate firmware are you running? Only the latest version (5.8) includes the command for this script. It looks like it gave an unexpected reply, so that's my best guess.
Got a question? Please ask in the forum for the fastest answers.

Re: BusPirate oscilloscope

Reply #22
What is the problem?
I'm working on a 64bit ubuntu 10:10


Drake


drake@drake-laptop:~/Scrivania/Bus Pirate/Oscope$ ./oscope_v1.2.py
Traceback (most recent call last):
  File "./oscope_v1.2.py", line 54, in
    bp = UART(BUS_PIRATE_DEV,115200)
  File "/home/drake/Scrivania/Bus Pirate/Oscope/pyBusPirateLite/UART.py", line 47, in __init__
    BBIO.__init__(self, port, speed)
  File "/home/drake/Scrivania/Bus Pirate/Oscope/pyBusPirateLite/BitBang.py", line 48, in __init__
    self.port = serial.Serial(p, s, timeout=t)
  File "/usr/lib/python2.6/dist-packages/serial/serialutil.py", line 166, in __init__
    self.open()
  File "/usr/lib/python2.6/dist-packages/serial/serialposix.py", line 175, in open
    raise SerialException("could not open port %s: %s" % (self._port, msg))
serial.serialutil.SerialException: could not open port /dev/ttyUSB0: [Errno 16] Device or resource busy: '/dev/ttyUSB0'
drake@drake-laptop:~/Scrivania/Bus Pirate/Oscope$

Re: BusPirate oscilloscope

Reply #23
You must define the right com port:

Quote
serial.serialutil.SerialException: could not open port /dev/ttyUSB0: [Errno 16] Device or resource busy: '/dev/ttyUSB0'

I could also be that an other program is using it and preventing access for other programs.

Re: BusPirate oscilloscope

Reply #24
Indeed, the device is busy! but by whom?
I tried to connect the Arduino and the terminal is perfect

Any ideas?


Thanks
Drake

Re: BusPirate oscilloscope

Reply #25
My best guess the buspirate isn't on ttyUSB0.

Unplug the buspirate, start an xterm with the command 'tail -f /var/log/messages', plug the buspirate in. Somewhere in the outputted messages it should say 'Found usb serial bridge' and something with starting with '/dev/tty' Your buspirate is connected here.

I type this from  the top of my head so the exact messages could be different (and distro dependant).

Re: BusPirate oscilloscope

Reply #26
Updating Python did not help here but now at least i know why there is a problem. It is Windows/Unix-Difference!

From the Python Docs:
Quote
select.select(rlist, wlist, xlist[, timeout])¶
This is a straightforward interface to the Unix select() system call. The first three arguments are sequences of ‘waitable objects’: either integers representing file descriptors or objects with a parameterless method named fileno() returning such an integer:

rlist: wait until ready for reading
wlist: wait until ready for writing
xlist: wait for an “exceptional condition” (see the manual page for what your system considers such a condition)
Empty sequences are allowed, but acceptance of three empty sequences is platform-dependent. (It is known to work on Unix but not on Windows.) The optional timeout argument specifies a time-out as a floating point number in seconds. When the timeout argument is omitted the function blocks until at least one file descriptor is ready. A time-out value of zero specifies a poll and never blocks.

The return value is a triple of lists of objects that are ready: subsets of the first three arguments. When the time-out is reached without a file descriptor becoming ready, three empty lists are returned.

Among the acceptable object types in the sequences are Python file objects (e.g. sys.stdin, or objects returned by open() or os.popen()), socket objects returned by socket.socket(). You may also define a wrapper class yourself, as long as it has an appropriate fileno() method (that really returns a file descriptor, not just a random integer).

Note File objects on Windows are not acceptable, but sockets are. On Windows, the underlying select() function is provided by the WinSock library, and does not handle file descriptors that don’t originate from WinSock.

And that's what happens in pyBusPirateLiteBitBang.py, line 113:
Quote
select.select([], [], [], timeout

So that does not work under Windoze :/

Re: BusPirate oscilloscope

Reply #27
Hey all.  I am trying to modify this script to be able to write the sampled data to a .mat file in addition to displaying on the screen.  I'm having trouble getting the sampling frequency right for all time scale settings.  Any ideas?

Re: BusPirate oscilloscope

Reply #28
Sorry if I warm up an old thread.
You write the bottleneck is the 115kBaud of the FTDI Chip.
But when I look at the FTDI Website they write the FT232 works with baudrates from 300Baud up to 3MegaBaud.
You will find more in the FTDI knowledge base on the web. Sorry, as a new user I cannot post a link.
Why don´t u use the higher baudrates for the oscope?