Giter Club home page Giter Club logo

buspirate's People

Contributors

clvlabs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

buspirate's Issues

Voltmeter mode doesn't work

Voltmetr mode of ADC produced never ending series of values. It doesn't work. Well, BusPirate is switched to voltmeter mode but this Python script doesn't read values. Voltage values are not separated by new line but rewritten in place with "0x08" control codes.

Example, test.txt:

d
d
D

Serial console, BusPirate:

HiZ>#
RE
Bus Pirate v3.b clone w/different PIC
Firmware v6.1 r1676  Bootloader v4.4
DEVID:0x044F REVID:0x3003 (24FJ64GA004 A3)
http://dangerousprototypes.com
HiZ>d
VOLTAGE PROBE: 0.00V
HiZ>d
VOLTAGE PROBE: 0.00V
HiZ>D
VOLTMETER MODE
Any key to exit
VOLTAGE PROBE: 0.00V
HiZ>

Script run with Python

***[ Bus Pirate scripting tool ]********************************************************************
Script file                             test.txt
COM port                                /dev/ttyUSB2
- Opening serial port
[OK] Serial port open
- Resetting board
>>> ------------------------------------| # 
<<< #
<<< RE
<<< Bus Pirate v3.b clone w/different PIC
<<< Firmware v6.1 r1676  Bootloader v4.4
<<< DEVID:0x044F REVID:0x3003 (24FJ64GA004 A3)
<<< http://dangerousprototypes.com
<<< HiZ>
- Sending script file (test.txt) - 4 lines
- Resetting board
>>> ------------------------------------| # 
<<< #
<<< RE
<<< Bus Pirate v3.b clone w/different PIC
<<< Firmware v6.1 r1676  Bootloader v4.4
<<< DEVID:0x044F REVID:0x3003 (24FJ64GA004 A3)
<<< http://dangerousprototypes.com
<<< HiZ>
>>> ------------------------------------| d 
<<< d
<<< VOLTAGE PROBE: 0.00V
<<< HiZ>
>>> ------------------------------------| d 
<<< d
<<< VOLTAGE PROBE: 0.00V
<<< HiZ>
>>> ------------------------------------| D 
<<< D
<<< VOLTMETER MODE
<<< Any key to exit

BTW, I miss possibility to have comments in BusPirate scripts...

Allow basic datalogging

As PSLLSP commented in #1 , the program is not very well suited for datalogging.

Review possibilities and make a first approach

configurable timout

I found this Python script interesting to upload and run BASIC scripts to BusPirate device. It works great for scripts that are fast. An example:

$ cat test6.bp 
s
new
10 AUX 1
20 FOR I=1 TO 5
30 LET A=ADC
40 PRINT I;": ";A
50 DELAY 20
60 NEXT I
70 AUX 0
80 PRINT "WORK DONE"
list
run
exit
$ python3 buspirate.py -c /dev/ttyUSB2 test6.bp

***[ Bus Pirate scripting tool ]********************************************************************
Script file                             test6.bp
COM port                                /dev/ttyUSB2
- Opening serial port
[OK] Serial port open
- Resetting board
>>> ------------------------------------| # 
<<< #
<<< RE
<<< Bus Pirate v3.b clone w/different PIC
<<< Firmware v6.3-beta1 r2151  Bootloader v4.4
<<< DEVID:0x044F REVID:0x3003 (24FJ64GA004 A3)
<<< http://dangerousprototypes.com
<<< HiZ>
- Sending script file (test6.bp) - 13 lines
>>> ------------------------------------| s 
<<< s
<<< HiZ(BASIC)>
>>> ------------------------------------| new 
<<< new
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 10 AUX 1 
<<< 10 AUX 1
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 20 FOR I=1 TO 5 
<<< 20 FOR I=1 TO 5
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 30 LET A=ADC 
<<< 30 LET A=ADC
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 40 PRINT I;": ";A 
<<< 40 PRINT I;": ";A
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 50 DELAY 20 
<<< 50 DELAY 20
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 60 NEXT I 
<<< 60 NEXT I
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 70 AUX 0 
<<< 70 AUX 0
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 80 PRINT "WORK DONE" 
<<< 80 PRINT "WORK DONE"
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| list 
<<< list
<<< 
<<< 10  AUX 1
<<< 20  FOR I=1 TO 5
<<< 30  LET A= ADC 
<<< 40  PRINT I;": ";A
<<< 50  DELAY 20
<<< 60  NEXT I
<<< 70  AUX 0
<<< 80  PRINT "WORK DONE"
<<< 65535  END 
<<< 67 bytes.
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| run 
<<< run
<<< 1: 388
<<< 2: 387
<<< 3: 387
<<< 4: 387
<<< 5: 424
<<< WORK DONE
<<< 
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| exit 
<<< exit
<<< Ready
<<< HiZ>
- Closing serial port

Other scripts, those run longer, are not able to finish because TIMOUT is triggered and Python session is closed. I have to run these scripts from terminal (like minicom or picocom). An example, the same script as before but it runs longer (DELAY increased from 20 to 100):

$ cat test6a.bp 
s
new
10 AUX 1
20 FOR I=1 TO 5
30 LET A=ADC
40 PRINT I;": ";A
50 DELAY 100
60 NEXT I
70 AUX 0
80 PRINT "WORK DONE"
list
run
exit
$ python3 buspirate.py -c /dev/ttyUSB2 test6a.bp

***[ Bus Pirate scripting tool ]********************************************************************
Script file                             test6a.bp
COM port                                /dev/ttyUSB2
- Opening serial port
[OK] Serial port open
- Resetting board
>>> ------------------------------------| # 
<<< #
<<< Ready
<<< HiZ>
- Sending script file (test6a.bp) - 13 lines
>>> ------------------------------------| s 
<<< s
<<< HiZ(BASIC)>
>>> ------------------------------------| new 
<<< new
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 10 AUX 1 
<<< 10 AUX 1
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 20 FOR I=1 TO 5 
<<< 20 FOR I=1 TO 5
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 30 LET A=ADC 
<<< 30 LET A=ADC
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 40 PRINT I;": ";A 
<<< 40 PRINT I;": ";A
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 50 DELAY 100 
<<< 50 DELAY 100
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 60 NEXT I 
<<< 60 NEXT I
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 70 AUX 0 
<<< 70 AUX 0
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 80 PRINT "WORK DONE" 
<<< 80 PRINT "WORK DONE"
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| list 
<<< list
<<< 
<<< 10  AUX 1
<<< 20  FOR I=1 TO 5
<<< 30  LET A= ADC 
<<< 40  PRINT I;": ";A
<<< 50  DELAY 100
<<< 60  NEXT I
<<< 70  AUX 0
<<< 80  PRINT "WORK DONE"
<<< 65535  END 
<<< 68 bytes.
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| run 
<<< run
<<< 1: 388
>>> ------------------------------------| exit 
<<< 2: 387
- Closing serial port

So I think it could be helpful to have a way to tell Python program to wait longer before TIMOUT disconnects it from the BP. I am not sure what is the best way to do it. The BASIC program can run on BP device for hours...

BASIC mode is not detected

When BusPirate device is in BASIC mode, it doesn't accept commands like #. This Python script runner is very useful to upload BASIC script to BusPirate but it doesn't detect if BusPirate is in BASIC mode and sends RESET command # as the first command during communication with BusPirate. exit is the command to leave BASIC mode...

$ cat test2.bp 
s
10 print "Hello World!"
list
$ python3 buspirate.py -c /dev/ttyUSB2 test2.bp

***[ Bus Pirate scripting tool ]********************************************************************
Script file                             test2.bp
COM port                                /dev/ttyUSB2
- Opening serial port
[OK] Serial port open
- Resetting board
>>> ------------------------------------| # 
<<< #
<<< Syntax error
<<< Ready
<<< HiZ(BASIC)>
- Sending script file (test2.bp) - 3 lines
>>> ------------------------------------| s 
<<< s
<<< Syntax error
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| 10 print "Hello World!" 
<<< 10 print "Hello World!"
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| list 
<<< list
<<< 
<<< 10  PRINT "HELLO WORLD!"
<<< 65535  END 
<<< 21 bytes.
<<< Ready
<<< HiZ(BASIC)>
- Closing serial port

When BP is not in BASIC mode, in most cases, initial RESET works:

***[ Bus Pirate scripting tool ]********************************************************************
Script file                             test2.bp
COM port                                /dev/ttyUSB2
- Opening serial port
[OK] Serial port open
- Resetting board
>>> ------------------------------------| # 
<<< #
<<< RE
<<< Bus Pirate v3.b clone w/different PIC
<<< Firmware v6.3-beta1 r2151  Bootloader v4.4
<<< DEVID:0x044F REVID:0x3003 (24FJ64GA004 A3)
<<< http://dangerousprototypes.com
<<< HiZ>
- Sending script file (test2.bp) - 3 lines
>>> ------------------------------------| s 
<<< s
<<< HiZ(BASIC)>
>>> ------------------------------------| 10 print "Hello World!" 
<<< 10 print "Hello World!"
<<< Ready
<<< HiZ(BASIC)>
>>> ------------------------------------| list 
<<< list
<<< 
<<< 10  PRINT "HELLO WORLD!"
<<< 65535  END 
<<< 21 bytes.
<<< Ready
<<< HiZ(BASIC)>
- Closing serial port

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.