Boundary Scan / JTAG

Last modified by Microchip on 2024/06/24 06:29

Setting up your first Boundary Scan/JTAG

Introduction

JTAG is the main standard for Boundary Scans. It works by having data flow through the boundary devices while reading the state of the pins to check that the connections on the PCB are working properly. The Boundary Scan Description Language (BSDL) files are required to determine if a single device is working as expected. For a Boundary Scan, the devices need to have dedicated registers.

To understand what a Boundary Scan is, visit the Microchip JTAG Boundary Scan page and associated links.

Hardware

Software

Many software packages for Boundary Scan are not free to use. See the attached zips, or use this Github link. Then go to releases and download the appropriate zip file. This should lead to the same zip files as attached.

Back to Top

Software Setup

Download the attached .zip files or follow this GitHub link

JTAG files on Github
There's no need for installation.  Just download the appropriate file for your PC.


Get the SEGGER JLinkARM.dll file

Go to the SEGGER J-Link main page. Then download and install the last J-Link software.

SEGGER J-LInk Software Download Page

Then go to the installation location, which you selected during the installation. By default, JLinkARM.dll file will be in C:\Program Files\SEGGER\JLink_V794b which is the same as the attached J-link file.

For Boundary Scans using the JTAG Boundary Scanner software, add the JLinkARM.dll file to the JTAGBoundryScanner program’s folder.

JLinkARM.dll File

This tells the GUI what interface it should look for. In our case it is J-link. If the JTAG is different, download the appropriate .dll file from its website. It should be in the driver’s folder.

BSDL File

Microchip provides a BSDL file for most devices with dedicated hardware, a JTAG Boundary Scan Interface. (BSC, BSR, TAP controller).
Microchip Online Docs

The purpose of this BSDL file is to configure a Boundary Scan for just one MCU/device. If you want to add more MCUs in the same Boundary Scan, you can gather the BSDL files for each MCU.  Ideally, you will get this file when designing the PCB because most PCB design tools include an automatic BSDL creation tool.

To get Microchip BSDL files, go to Microchip Online Docs and search. Note that the proper BSDL file may not be under the BSDL filter. In our case, for dsPIC33CK256MP508, see the BSDL file attached.

For Boundary Scan use the JTAG Boundary Scanner, the .bsdl file needs to be copied into the “bsdl_files” folder

Back to Top

Hardware Setup

Connect TDO, TDI, TCK, TMS, VTref, and GND pins. One GND pin is all that is needed. VTref is connected to Vdd=Vcc=3.3V. Below is a diagram showing each pin in the J-link and its function.
J-Link pins and functions

Below is a snapshot of the DSPIC33CK Curiosity Development Board datasheet indicating where to connect the JTAG pins.

DSPIC33CK Curiosity Development Board datasheet indicating where to connect the JTAG pins

If you have a different MCU, check the datasheet to determine where to connect these four pins. The following image is how the setup should look:

Setup example

Back to Top

Firmware Setup

JTAGEN

The JTAGEN bit controls whether the pins are used as JTAG or standard I/O pins. In the dsPIC33CK256MP508, the MCU contained in our dsPIC33 board, the name of the register containing JTAGEN is FICD. This name may vary in other MCUs.

This register can be a configuration bit depending on the MCU. In our case, it is a configuration bit.
This register is set as 1 when the Flash memory is erased. This is done so a Boundary Scan can be done without programming the chip. But the value of JTAGEN is 0 when the MCU is programmed with an MPLAB X IDE code that doesn’t specify it.

Verify that this bit is set as 1 whenever a Boundary Scan occurs. Connect the board through a USB or a PICkit (adding headers) to the computer. 

Bench Setup

If JTAGEN is not a configuration bit: Create a simple program adding a line to set JTAGEN. For example, for the PIC32MX340F128H:

DDPCONbits.JTAGEN=1

If JTAGEN is a configuration bit: you can create a program modifying the configuration bits:

#pragma config JTAGEN = ON               //JTAG Enable bit (JTAG is enabled)

For more information, see Microchip Online Docs

Or you can use MPLAB X IPE to modify it:
Configuration Bits in MPLAB X IDE

JTAGBoundaryScanner

Open the JTAGBoundaryScanner.exe file, previously downloaded.
JTAGBoundaryScanner.exe file

Click on Probe and then the displayed option
Probe Menu

Click Probe and then Get ID

Device ID

Click again on JTAG Chain and the new Device now appears. Now select the proper BSDL file, previously downloaded.

You may get an error for two different reasons:

  • The device BSDL file doesn’t match with the one being used. Make sure you are using the proper BSDL.
  • The revision of the device is different than the BSDL revision.

Device Mismatch Error

This shouldn’t make the Boundary Scan fail. You can click Yes and continue without worrying. Avoid the notification by opening the BSDL file and modifying its ID to match the Device ID.

Now you should see something similar to this:
Boundy Scanner Checkboxes

To understand the columns O, OE, I and T, and the two Boundary Scan modes, click on Help > Help.
Help Menu

To start the Boundary Scan, click Scan mode and select a refresh rate and the Boundary Scan mode. 

Scan Mode

Now you can start doing Boundary Scans. If using the DSPIC33CK Curiosity Development Board, try ticking the “OE” and “O” boxes of RE13, RE14, and RE15 pins. This should make the LED change its color, according to its datasheet.

RGB LED

Note:
• In SAMPLE mode, you can control any tick box, just look at the value of the “I” tick boxes.
• In EXTEST mode, OE should be set for controlling the output with the O tick box, and “I” tick box should reply to the value of “O” with a little delay
• This is a simple software for it, without writing a specific BSDL file. Boundary Scans can be used for more powerful purposes than this one.

Back to Top