ArduTAP is an Arduino library designed to facilitate communication with devices using the JTAG protocol and based on ArduJTAG library. It provides an intuitive and straightforward interface for interfacing with JTAG Test Access Ports (TAPs).
- Simple and easy-to-use API for interacting with JTAG devices.
- Supports basic JTAG operations such as reading from and writing to instruction and data registers.
- Allows setting up and controlling the JTAG communication speed and other parameters.
-
Clone this repository into Arduino/Libraries or use the built-in Arduino IDE Library manager to install a copy of this library.
-
Include in your sketch
#include "TAP.hpp"
Install ArduTAP using the platformio library manager in your editor, or using the PlatformIO Core CLI, or by adding it to your platformio.ini as shown below:
[env]
lib_deps =
ArduTAP
[env]
lib_deps =
https://github.com/Zamuhrishka/ArduTAP.git
For current library any JTAG instruction must be rerpresent by next structure:
struct Instruction
{
uint16_t code; // Instruction code
uint16_t ir_len; // Length of the instruction register
uint16_t dr_len; // Length of the data register
};
For example if you want to execute IDCODE
instruction then you need create next variable:
Instruction_s IDCODE = {.code = 0x1FE, .ir_len = 9, .dr_len = 32};
And use this variable as argument for TAP methods.
For reading data, the following function is used:
/**
* \brief Read data from the device by applying the given instruction and
* storing the output
*
* \param instruction Instruction structure containing the code and lengths
* \param data Pointer to a buffer where the output data will be stored
*/
void read(const Instruction_s &instruction, uint8_t *data);
The data array will be store readded bits from TAP. Format of this bits are same as for ArduJTAG, please see accordig paragraph of the ArduJTAG README.md
file.
For writing data, the following function is used:
/**
* \brief Write data to the device using the given instruction
*
* \param instruction Instruction structure containing the code and lengths
* \param data Pointer to the data to be written
*/
void write(const Instruction_s &instruction, /*const*/ uint8_t *data);
The data array will be store bits for write to TAP. Format of this bits are same as for ArduJTAG, please see accordig paragraph of the ArduJTAG README.md
file.
For executing, the following function is used:
/**
* \brief Execute a JTAG operation given an instruction, input data, and an
* output buffer
*
* \param instruction Instruction structure containing the code and lengths
* \param input Pointer to the input data
* \param output Pointer to the buffer where the output data will be stored
*/
void execute(const Instruction_s &instruction, /*const*/ uint8_t *input, uint8_t *output);
The main feature of this function is that it give possibility wtite data to the TAP and read data from the TAP in same moment.
If you need just read data from DR
register without executing any instruction then you need use function:
/**
* \brief Read raw data of specified length from the device
*
* \param input Pointer to the input data
* \param data Pointer to a buffer where the output data will be stored
* \param len Length of the data to read
*/
void read_raw(uint8_t *input, uint8_t *data, uint16_t len);
More examples of using this library can be found in examples.
Bug reports and/or pull requests are welcome.
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.