Giter Site home page Giter Site logo

bpmicro's Introduction

BP Microsystems open source driver
Developed against BP 1410


sudo pip install libusb1


********************************************************************************
Why does this project exist?
********************************************************************************
I actually find BPWin to be pretty decent for simple tasks
However, I need to run some special analysis on a Linux system and need API level access
BPWin charges even for their Windows API, and I don't want to deal with GUI scripting
For most people you are probably better off using the vendor software
There are also some other Linux friendlier options today such as Linux minipro tools
However, BPM offers much better continuity, overcurrent, and other protections


********************************************************************************
Still reading? Okay!
********************************************************************************
It is unknown as of this writing how applicable the current code is to other models
It is suspected that part of the code could be refactored for parallel port support
(if someone generated equivilent traces)


********************************************************************************
Adding a new device
********************************************************************************
What you'll need:
-Linux host w/
    Virtualization software (I use VMWare player)
    Wireshark
-Windows guest w/
    BPWin software (I use 5.33.0)
-Device you want to support
-A pattern handy, such as what to write, or a known pattern on the device

Do the following to capture the packets:
-Host: start usbmon
-Host: start wireshark (root and/or usb permissions may be needed)
-Host: use lsusb to see which devices are present
-Turn on BP and plug into computer
-Host: use lsusb again and see which device is new. Note the USB bus number
-Host: start guest using your virtualization software
-Connect the USB device to the VM
-Host: run lsusb again. You should see that the device number has bumped by 1 (per fxload). Record this number
-Guest: start BPWin
-Guest: select a device you want to support and ensure device is in socket. Do a test read in BPWin if you like
-Host: start capture on the usb bus noted earlier
-Guest: run the operation you want to support (ie read)
-Host: stop capture
-Host: save capture. I name mine like "pic17c43_20187-02-10_02_read_cont-y-id-y.cap"
    That is: <device>_<date>_<capture#>_<operation>_<options>.cap

Decoding the capture
I use a script that looks something like this:
    function process() {
        base=$1
        id=$2
        usbrply --fx2 --device $id -j $base.cap >$base.json
        python ../../scrape.py $base.json >$base.py
        python ../../scrape.py --dumb $base.json >${base}_dumb.py
    }

    process pic17c43_20187-02-10_02_read_cont-y-id-y 6
Where 6 is the device number noted earlier
    If you didn't record this, open up the capture in Wireshark and look for relevant traffic
    If its the only device on the bus, this should be obvious
    If you have other devices (such as keyboard/mouse), look for the one with bulk traffic
Now:
-Run the script
    Note: some flags are set to drop various packets (such as read only commands)
    See scrape help for details
-Open the main .py (ie non-dumb) file
-Note: device support is typically composed of a functionality and firmware (fw) file
-Use an existing support file pair as a template for your device to support, renaming and copying into relevant architecture directory
    Ex: 8052, 8751, and at89c51 all go into mcs51 directory
    Create a new directory if needed (and make sure to add __init__.py file)
-Replace the firmware provided by your template with the generated firmware
-Rename the class to match your new device
-Replace the code provided with your remplate with the generated code
-Tweak import at top to have something like "import bpmicro.pic.pic17c43_fw as my_fw"
-Look at the firmware blobs for the one that is actually your firmware. Make this a code read like done in your template file
-Consider adding this firmware definition to scrape.py so its in its firwmare database
-Edit devs.py to add your device by adding import and adding to list
-Test by running a command like: python main.py read pic17c43
    Disconnect from vmware if you haven't already



python scrape_dev.py bp1410-84_2020-03-31_s87c751/2020-03-31_05_win_s87c751_read_pat-cnt_cont-n_id-n.pcapng  >bpmicro/mcs51/s87c751.py

bpmicro's People

Contributors

johndmcmaster avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bpmicro's Issues

BP-1410 custom firmware demo

Document peripherals enough to load custom FW. Little is known today other than the main CPU is something like a 486 running DOS.

Proof of concept ideas:

  • read out an EPROM
  • read out the power supply voltages

Document socket module pinout

Would be really useful to understand the pinout. This might allow things like a TL866 adapter. A good proof of concept would be to read out the EEPROM.

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.