Giter Club home page Giter Club logo

pyjtagbs's Introduction

JTAG with the BS (Boundary Scan) - pyjtagbs

If you've tried to get boundary scan working under Python, you'll truly appreciate the name pyjtagbs.

This is a thin wrapper on a very nice library currently, giving you simple Python access to JTAG Boundary Scan pins. Future work will implement some features in native Python (most of it already exists in other libraries).

from jtagbs import JTAGCore, JTAGBS

interface = JTAGCore()
jtag = JTAGBS(interface)

probes = jtag.list_available_probes()
print(probes)

jtag.open_probe('JLINK')
jtag.init_scanchain()

print(jtag.list_devids())
print(jtag.list_devices())

stm32 = jtag.get_device(1)

stm32.set_bsdl(r"bsdl_files/st/stm32f4/STM32F405_415_407_417_LQFP64.bsd")

print(stm32.list_pins())

print(stm32.get_pin_state("PC2"))
print(stm32.get_pin_state(["PC2", "PC1"]))

stm32.set_scan_mode("active")

stm32.set_pin_state("PC15", True)
stm32.set_pin_state("PC14", True)

stm32.set_pin_state(["PC15", "PC14"], [True, False])

stm32.set_pin_state(["PC15", "PC14"], [None, None])

#spi = device.spi(clk="PA11", copi="PA12", cipo="PA13", cs="PA14")

'JTAG Boundary Scanner' Tool & Library

100% of the actual work is done by the amazing JTAG Boundary Scanner tool available at https://github.com/viveris/jtag-boundary-scanner.

That library was developed by Viveris (credit to Jean-François DEL NERO & Sébastien Corbeau).

WARNING: The .dll in the repo is only a 32-bit build, so this only works with 32-bit Python on Windows

This library supports FTDI cables along with Segger J-Link tools.

Using J-Link

The device can use a J-Link, it needs Segger's DLL as well for that. For some reason the J-Link DLL needs to be at the same location as your file that is running from (to be fixed), so to run 'example.py' you need the DLL in that folder as well (or install the DLL to your Windows system path - which may be dangerous as other tools will find that version).

More JTAG Features

Future work may support other backends - some of the features (such as BSDL parsing) required are available in Python implementations already. However having SPI & I2C access is nice with the speed of the compiled C library.

PyLink Interface

The initial "other backend" is the PyLink interface.

Other Tools Worth Mentioning

  • urJTAG - open source JTAG tooling, the original!
  • TopJTAG - low-cost ($100) with GUI that shows each pin on the package itself - very handy for debug.

GUI

For a GUI, see the https://github.com/viveris/jtag-boundary-scanner which offers a nice GUI interface to view each pin state.

BSDL Sources

BSDL files are found around the web. For ST devices, see the "CAD Resources" tab, i.e.: https://www.st.com/en/microcontrollers-microprocessors/stm32f405og.html#cad-resources

JTAG Notes

Some devices have JTAG that is shared between debug & boundary scan by a physical pin (for example - Microchip SAM3U). For these devices your board is likely configured only for debug access, you may need to change a pin strap or similar.

pyjtagbs's People

Contributors

alex-dewar avatar colinoflynn avatar

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.