SWD and JTAG selection mechanism

SWJ-DP enables either an SWD or JTAG protocol to be used on the debug port.

To do this, it implements a watcher circuit that detects a specific 16-bit selection sequence on the SWDIOTMS pin:

  • A 16-bit sequence is used to switch from JTAG to SWD operation

  • Another 16-bit sequence is used to switch from SWD to JTAG.

The switcher defaults to JTAG operation on power-on reset,

therefore the JTAG protocol can be used from reset without sending a selection sequence.

Switching from one protocol to the other can only occur when the selected interface is in its reset state.

JTAG must be in its Test-Logic-Reset (TLR) state and SWD must be in line-reset.

The SWJ-DP contains a mode status output, JTAGNSW,

that is HIGH when the SWJ-DP is in JTAG mode and LOW when in SWD mode. This signal can be used to:

  • disable other TAP controllers when the SWJ-DP is in SWD mode, for example by disabling TCK or forcing TMS HIGH

  • multiplex the Serial Wire output, TRACESWO, on to another pin such as TDO when in SWD mode.

Another status output, JTAGTOP, indicates the state of the JTAG-DP TAP controller. These states are:

  • Test-Logic-Reset

  • Run-Test/Idle

  • Select-DR-Scan

  • Select-IR-Scan.

This signal can be used with JTAGNSW to control multiplexers so that,

for example, TDO and TDI can be reused as General Purpose Input/Output (GPIO) signals when the device is in SWD mode.

The watcher block puts itself to sleep when it has finished tracking a specific sequence and only wakes up again

when it detects the next reset condition.

Figure 2.3 is a simplified state diagram that shows how the watcher transitions between sleeping, detecting, and selection states.

Figure 2.3. SWD and JTAG select state diagram

SWJ-DP switching sequences

The SWJ-DP switching sequences are described in:

  • JTAG to SWD switching

  • SWD to JTAG switching.

JTAG to SWD switching

To switch SWJ-DP from JTAG to SWD operation:

  1. Send more than 50 SWCLKTCK cycles with SWDIOTMS=1.
    This ensures that both SWD and JTAG are in their reset states

  2. Send the 16-bit JTAG-to-SWD select sequence on SWDIOTMS

  3. Send more than 50 SWCLKTCK cycles with SWDIOTMS=1.
    This ensures that if SWJ-DP was already in SWD mode,
    before sending the select sequence, the SWD goes to line reset.

  4. Perform a READID to validate that SWJ-DP has switched to SWD operation.

The 16-bit JTAG-to-SWD select sequence is defined to be 0b0111100111100111, MSB first.
This can be represented as 16'h79E7 if transmitted MSB first or 16'hE79E if transmitted LSB first.

This sequence has been chosen to ensure that the SWJ-DP switches to using SWD
whether it was previously expecting JTAG or SWD.

As long as the 50SWDIOTMS=1 sequence is sent first,
the JTAG-to-SWD select sequence is benign to SW-DP,
and is also benign to SWD and JTAG protocols used in the SWJ-DP,
and any other TAP controllers that might be connected to SWDIOTMS.

SWD to JTAG switching

To switch SWJ-DP from SWD to JTAG operation:

  1. Send more than 50 SWCLKTCK cycles with SWDIOTMS=1.
    This ensures that both SWD and JTAG are in their reset states.

  2. Send the 16-bit SWD-to-JTAG select sequence on SWDIOTMS.

  3. Send at least five SWCLKTCK cycles with SWDIOTMS=1.
    This ensures that if SWJ-DP was already in JTAG mode
    before sending the select sequence, it goes into the TLR state.

  4. Set the JTAG-DP IR to READID and shift out the DR to read the ID.

The 16-bit JTAG-to-SWD select sequence is defined to be 0b0011110011100111, MSB first.
This can be represented as 16'h3CE7 if transmitted MSB first or 16'hE73C if transmitted LSB first.

This sequence has been chosen to ensure that the SWJ-DP switches to using JTAG
whether it was previously expecting JTAG or SWD.

If theSWDIOTMS=1 sequence is sent first, the SWD-to-JTAG select sequence is benign to SW-DP,
and is also benign to SWD and JTAG protocols used in the SWJ-DP,
and any other TAP controllers that might be connected to SWDIOTMS.

Restriction on switching

It is recommended that when a system is powered up, a debug connection is made, and the mode is selected,

either SWD or JTAG, that the system remains in this mode throughout the debug session.

Switching between modes must not be attempted while any component of the DAP is active.

If you attempt to switch between modes while any component of the DAP is active,

there can be unpredictable results.

A power-on reset cycle might be required to reset the DAP before switching can be retried.

SWD and JTAG selection mechanism的更多相关文章

  1. 浅论各种调试接口(SWD、JTAG、Jlink、Ulink、STlink)的区别

    JTAG协议 JTAG(Joint Test Action Group,联合测试行动小组)是一种国际标准测试协议(IEEE 1149.1兼容),主要用于芯片内部测试.现在多数的高级器件都支持JTAG协 ...

  2. jlink的SWD与JTAG下载模式的对应接线方法

     参考博客:http://blog.csdn.net/qq_26093511/article/details/59484249 (1)如果用jtag模式下载的话需要接线:          jlink ...

  3. STM32的JTAG、SWD和串口下载的问题

    最近有一个项目用到STM32,为了使PCB布线方便一些所以改了一些引脚,占用了JTAG接口的PA15和PB3,所以要禁用一下JTAG,下载采用SWD模式.这样在实际操作中做出一些总结(方法网上都有.这 ...

  4. SWD模式和JTAG模式

    一.功能 SWD模式:仿真 下载 JTAG模式:仿真 下载 二.接口 1.J-link JTAG/SWD接口 2.开发板接口电路 ①SWD模式 4根线(包片机) ②JTAG模式 20脚JTAG(网络) ...

  5. STM32 ~ JTAG、SWD和串口下载的问题

    最近有一个项目用到STM32,为了使PCB布线方便一些所以改了一些引脚,占用了JTAG接口的PA15和PB3,所以要禁用一下JTAG,下载采用SWD模式.这样在实际操作中做出一些总结(方法网上都有.这 ...

  6. Serial Wire Debug (SWD) Interface -- PSoc5

    PSoC 5 supports programming through the serial wire debug (SWD) interface. There are two signals in ...

  7. SWD烧录/仿真方式

    单片机在烧写/仿真的时候具有一种方式叫做SWD,这种方式只用到两根线SWDIO,SWCLK.一般SWD和JTAG中的JTMS和JTCK共用的.由于线少,所以使用非常方便,但是速率相对较低. 在接线时, ...

  8. Introduction to Cortex Serial Wire Debugging

    Serial Wire Debug (SWD) provides a debug port for severely pin limited packages, often the case for ...

  9. ARM Cortex Design Considerations for Debug

    JTAG was the traditional mechanism for debug connections for ARM7/9 parts, but with the Cortex-M fam ...

随机推荐

  1. 按esc键 关闭模态框

    <!-- help start --> <div class="modal fade" id="myModal" tabindex=" ...

  2. SQL Server 连接池 (ADO.NET) MSDN

    连接到数据库服务器通常由几个需要很长时间的步骤组成. 必须建立物理通道(例如套接字或命名管道),必须与服务器进行初次握手,必须分析连接字符串信息,必须由服务器对连接进行身份验证,必须运行检查以便在当前 ...

  3. 解决Python3 pip list 红色DEPRECATION

    解决Python3 pip list 红色DEPRECATION 打开文件扩展名和隐藏的项目 找到ProgramData,在该目录下创建pip文件夹,在pip里面创建pip.ini  在pip.ini ...

  4. /dev/null和/dev/zero的区别

    /dev/null,外号叫无底洞,你可以向它输出任何数据,它通吃,并且不会撑着!/dev/zero,是一个输入设备,你可你用它来初始化文件. /dev/null------它是空设备,也称为位桶(bi ...

  5. WebApi帮助类

    public class HttpClientBase { /// <summary> /// HttpClient实现Post请求 /// </summary> protec ...

  6. .NetCore下使用Prometheus实现系统监控和警报 (二)Linux安装

    Prometheus对Windows有相关的支持  下载地址:https://prometheus.io/download/ wget https://github.com/prometheus/pr ...

  7. 【CodeChef】QTREE- Queries on tree again!

    题解 给你一棵基环树,环长为奇数(两点间最短路径只有一条) 维护两点间路径最大子段和,支持把一条路径上的值取反 显然只要断开一条边维护树上的值,然后对于那条边分类讨论就好了 维护树上的值可以通过树链剖 ...

  8. linux上jenkins连接windows并执行exe文件

    1.如果要通过ssh的方式来连接windows的话,首先需要在windows上安装freesshd来配置启动.配置ssh(win10上自带了openssh可以进行安装使用,但我机器装不上) 1.1.下 ...

  9. Successor hdu 4366 线段树

    题意: 现在n个人,其中编号0的是老板,之后n-1个员工,每个员工只有一个上司,有一个忠诚值和能力值.每次要解雇一个人的时候,从他的下属中选取能力值大于他的且忠诚值最高的一个,若不存在则输出-1.共m ...

  10. 修改MySQL中的数据

    一:insert语句 1.介绍 在执行插入语句前,需要具有执行INSERT语句的INSERT权限. 2.准备环境 3.简单insert语句 4.插入多行 在这种形式中,每行的值列表用逗号分隔. 如果为 ...