25 Jul 2016, 21:44

ProteusISC Intro

Proteus ISC is a driver framework for managing In System Configuration Controllers (such as JTAG or SPI adapters).

Adapt is a reference implementation for using Proteus ISC to build a useful command line tool without having to worry about drivers for your controlleradapter of choice.

Motivation

Billions of devices have a form of ISC (In System Configuration) built into their hardware to allow programming and instrumentation. The protocols to communicate with these devices are often well conceived electrical standards sending proprietary messages to the device.

By default, the only tools available to talk to these devices are vendor provided, and often non free or tied up with licenses. Luckily open tools are actively maintained that provide drivers to communicate with these devices.

But for any software to configure a device, the software must send the device bound data through some form of controller or adapter (for example USB to JTAG). Each of these controllers have a unique API which is often undocumented. Developers who wish to write a tool for a new chip type must add support for at least one controller before they are able to build their tools. The result is often subpar controller support.

Furthermore, open drivers for controllers often do not take full advantage of the hardware, which can leave a $200 high end device programmer loading programs as fast as bit banging the data to the device.

Proteus ISC solves this issue by providing a controller support as a library. Any tool developer can spend their time writing drivers for their device with the controller presented as a simple pipe for their commands.

Proteus ISC also supports lazy execution of commands with an aggressive optimization engine that takes full advantage of controller hardware by recomposing your requests into more favorable groupings.

Download

Pypi packages

#Proteus ISC
pip3 install proteusisc
#Adapt
pip3 install adaptisc

Firmware, UDEV rules, and firmware loading utilities

Required to initialize controllers with firmware and set the device access permissions.

wget -qO - http://apt.proteusisc.org/proteusisc.public.gpg-key | sudo apt-key add -
echo deb http://apt.proteusisc.org testing main | sudo tee /etc/apt/sources.list.d/proteusisc.list
sudo apt-get update
sudo apt-get install proteusisc-controller-firmware

Github Projects

Documentation

http://diamondman.github.io/Adapt/

27 Jul 2016, 02:32

JTAG Already Enabled Error

Symptom

When enabling a controller’s JTAG output in Adapt, the following error is reported:

**********************************************************
*       Error: JTAG Already Enabled on Controller!       *
*  Controller is either in use or left in invalid state. *
*   Use -noerr flag to ignore this error or powercycle   *
*         your controller. Use at your own fish.         *
*   http://proteusisc.org/help/JTAGAlreadyEnabledError   *
**********************************************************

Cause

Many JTAG controllers have commands to enable and disable jtag output. Some of these controllers will fail if their JTAG Enable command is sent when they already have JTAG output enabled. This is intended to prevent multiple people from using the controller at the same time.

If a controller fails to enable JTA output multiple times in a row, its driver should raise the JTAGAlreadyEnabledError exception, which will stop the current action and report the above error.

Often this happens because a program shut down improperly, leaving the controller in an improper state. The controller may work perfectly well, but the driver believes it is in use and will not take control.

Solution

If another program is using the controller, then close that program.

If no program is using the controller and you believe the controller is in an invalid state, simply power cycle the controller.

If this is happening often (for example you are developing a driver), you can provide the -noerr flag to adapt to silence this error and have proteus try to continue using this controller.

JTAGAlreadyEnabledError

26 Jul 2016, 16:14

Controller Inaccessible Error

Symptom

When initializing a controller’s scan chain in Adapt, the following error is reported:

**********************************************************
*    Controller Inaccessible: Permission Denied Error    *
* http://proteusisc.org/help/ControllerInaccessibleError *
**********************************************************

Cause

In linux, usb devices appear as files. These files by default have very restrictive permissions that require root access to read and write to. Rules files can be installed that instruct the UDEV subsystem to give more reasonable permissions to devices that match a filter.

Attempting to access a device with default permissions will produce a Permission Error.

If you are encountering this error it is likely that you either have not installed the provided proteusisc-controller-firmware debian package, are unable to install the package due to being on an incompatable system, or are a developer creating a new driver for one of your controllers and have not added the appropriate UDEV rules to your system.

Solution

General Users with a supported controller:

A debian package is available that adds sane device permission defaults for supported devices. It can be installed with by running te following:

wget -qO - http://apt.proteusisc.org/proteusisc.public.gpg-key | sudo apt-key add -
echo deb http://apt.proteusisc.org testing main | sudo tee /etc/apt/sources.list.d/proteusisc.list
sudo apt-get update
sudo apt-get install proteusisc-controller-firmware

Then detach and raattach your controller/dev board.

Non Debian Users:

If you are on a non Debian based system (such as RedHat) and want the package to be available to you, please goto https://github.com/diamondman/proteusisc-firmware-loader and open an issue. Pull requests are welcome.

Until a package is available for you, the .rules fules in the repository above can be installed into your /etc/udev/rules.d folder, or your distribution’s equivalent.

ProteusISC Controller Driver Developer:

If you are a developer adding a controller driver to proteusisc, your new controller will not have udev rules to set the permissions to a useful default.

Create a new file /etc/udev/rules.d/{controller}.rules containing something like this

ATTR{idVendor}=="0000", ATTR{idProduct}=="0000", MODE:="666", RUN+="command_to_run"

Each clause in this line is optional. Commands run from rules can be provided details about the new device. Look at rules files in the proteusisc-controller-firmware for samples, or consult

man udev

for details on rule syntax, uses, and variables.

DevicePermissionDeniedError