Cmsis dap что это

от admin

CMSIS-DAP

CMSIS-DAP is open-source debug firmware from ARM. It connects to a CoreSight Debug Acces Port (DAP) on a target device, via either ARM’s Serial Wire Debug (SWD) or JTAG, and relays commands between the DAP and USB.

To make installation easier on Windows, the firmware enumerates as a USB HID. The packets exchanged with it are unstructured 64 byte reports. (Microchip did exactly the same thing with their PICKit2.) The code has a somewhat curious license: it can be freely used and modified, as long as it is deployed on an ARM Cortex processor.

NOTE: You may also be interested in reading about DAPlink, which expands the capabilities of CMSIS-DAP.

It is connected like this:

Getting the source & documentation

Download the CMSIS-DAP sources and protocol documentation (an account is required, but signing up is free).

The code can only be built using Keil’s MDK software.

Getting pre-built binaries

The only prebuilt binaries I am aware of are the OpenSDA versions intended for use on Freescale’s FRDM boards. I have written instructions for fixing the FRDM firmware; essentially, by installing CMSIS-DAP on FRDM boards.

Appreciation

After carefully reading the documentation, and then even more carefully reading the C source code, and then cross-referencing five or seven different ARM documents (ARM architecture manuals, debug manuals, processor manuals), I was, in the space of a few days’ time, able to get muforth to talk to the CMSIS-DAP firmware installed on a FRDM board and lay open the guts of the KL25Z chip.

It’s a simple and well-designed protocol. And since getting it to work involves digging deeply into CoreSight, SWD, and other ARM debug arcana, I’ve developed an appreciation for the overall design. I’m impressed.

Conjecture

I can’t read ARM’s collective mind, but my conjecture is that ARM created CMSIS-DAP because they were irritated by the profusion of proprietary and undocumented debug interfaces in the so-called “ARM ecosystem”. If this is the reason, I can certainly relate, having decided to build my own BDM debug for Freescale’s S08 family of 8-bit microcontrollers. I looked at the DEMO boards available and was frustrated by the fact that P & E decided to “lock down” the debug ports on these boards. And they were undocumented, which didn’t work for me – I wanted to connect with them via muforth, and avoid using CodeWarrior.

We now have the same problem with ARM Cortex-M development boards. ST-Micro uses ST-LINK on their STM32 Discovery series. TI uses ICDI on the Stellaris Launchpad. And Freescale’s FRDM boards ship with something called OpenSDA – which isn’t open at all.

At least OpenSDA allows CMSIS-DAP to be installed on the FRDM boards. Otherwise the boards are useless!

Tips and tricks

Even though the documentation is pretty thorough, there were a few hurdles to getting connected to the target chip.

First, a “line reset” connection sequence is necessary. This involves clocking a sequence of bits into the SW-DP. ARM’s documentation – the ARM Debug Interface v5 spec and the ADI v5.1 supplement – disagreed on what this sequence should be. I settled on sending 56 ones followed by 8 zeros, and this seemed to work.

Artekit AK-CMSIS-DAP JTAG/SWD

This is the user manual and guide for the AK-CMSIS-DAP JTAG/SWD board.

Introduction

In this guide we are going to learn about the Artekit AK-CMSIS-DAP JTAG and how to use it with the most known IDEs and debugging software.

The AK-CMSIS-DAP is a JTAG/SWD probe based on the CMSIS-DAP standard (also known as DAPLink). The CMSIS-DAP standard not only eases the access to the Coresight Debug Access Port (DAP) of ARM Cortex microcontrolles, but also unifies all the JTAG protocols in a way that users and developers won’t need to support every JTAG/SWD probe protocol in their hardware/software tools.

The AK-CMSIS-DAP JTAG/SWD board is the Artekit implementation of that standard, running on quartzless SiLabs Happy Gecko EFM32 Cortex M0+ (the EFM32HG308F64G-B-QFN24), with 64KB Flash and 8KB RAM running at 25 MHz, completely open source and open hardware.

We also added buffered inputs/outputs allowing to connect targets powered from 1.8V up to 5V, isolating the lines from the internal 3.3V voltage and protecting the internal MPU pins from external short-circuits and over voltages.

The hardware

The AK-CMSIS-DAP board has one 20-pin standard JTAG connector on one side and a strip of 7 utility pins on the other. The following picture and table show the signals you can find in the standard 20-pin JTAG connector.

PIN Type USAGE
1 IN Target VCC. Must be connected to the Target VCC
2 No internal connection
3 OUT #TRST output (open collector)
4 PWR Ground
5 OUT TDI JTAG signal
6 PWR Ground
7 I/O TMS Output in JTAG mode, SWDIO I/O in SWD mode
8 PWR Ground
9 OUT TCK output in JTAG mode, SWDCLK output in SWD mode
10 PWR Ground
11 No internal connection
12 PWR Ground
13 INP TDO input in JTAG mode
14 PWR Ground
15 OUT Target #RESET output (open collector)
16 PWR Ground
17 No internal connection
18 PWR Ground
19 No internal connection
20 PWR Ground

In the top of the board you can see a 7-pin connector and a BOOT push button as shown in the following picture:

The AK-CMSIS-DAP comes programmed with an internal bootloader to upgrade the firmware using a simple RS232 line and a PC terminal program as TeraTerm. To upgrade the firmware please read the Upgrading the firmware section.

The connector pinout signals:

PIN Type USAGE
VCC PWR 3.3V output from the MCU internal regulator. Can source maximum 10mA.
RESET INP Active low. Resets the internal MCU.
SWDCLK OUT SWD clock output. EFM32 debug port.
SWDIO I/O SWD data input/output. EFM32 debug port.
TXD OUT Internal UART TXD signal. For firmware upgrade or debug purposes.
RXD INP Internal UART RXD signal. For firmware upgrade or debug purposes.
GND PWR Board ground signal.

In the AK-CMSIS-DAP, all inputs and outputs signals, to and from the JTAG/SWD connector, are buffered. It is very important to connect the pin 1 (Vcc) of the JTAG/SWD connector to the target board Vcc to adapt the internal AK-CMSIS-DAP buffers to the target signal levels.

Drivers

The CMSIS-DAP standard uses the USB HID protocol as the transport protocol, so you don’t need any drivers, no matter the operating system, to use the AK-CMSIS-DAP board. All you need is a standard USB mini cable.

Usage with KEIL uVision

Connect the AK-CMSIS-DAP to the target and to the PC, using the USB cable. In KEIL uVision, click on the “Options for Target…” button.

A new window should open. Go to the Debug tab and select CMSIS-DAP Debugger from the drop-down menu, as in the following picture. Then click on the Settings button.

In the next windows select the AK-CMSIS-DAP device. Set the JTAG or SW modes according to your target’s characteristics. In the JTAG Device Chain you can view the target device code (an STM32F103 in this case).

Usage with with IAR

Connect the AK-CMSIS-DAP to the target and to the PC, using the USB cable. Launch the IAR Embedded Workbench IDE and select Options from the Project menu.

In the next windows select Debugger/CMSIS-DAP from the menu on the left.

From this window you can configure how IAR will connect to your target through the AK-CMSIS-DAP. Select the Interface tab an configure the JTAG or SWD protocol according to your target’s characteristics.

Usage with OpenOCD

The AK-CMSIS-DAP can be used with OpenOCD as a debugging or flashing probe. You can download a precompiled version of OpenOCD for Windows from the Freddie Chopin webpage. Linux users should build OpenOCD from source or download it through, for example, apt-get on Ubuntu distros.

To use OpenOCD with SWD protocol, type from the command line:

To use OpenOCD with JTAG protocol, type from the command line:

In the examples here above, the xxxxxx.cfg file is your target MCU, for example, stm32f1x.cfg for a STM32F1xx.

The following picture shows how it should look like when OpenOCD successfully connects to the target.

Upgrading the firmware

If needed, you can download a new firmware to the AK-CMSIS-DAP board. This is done through the EFM32 serial port signals exposed on the 7-pin connector. The serial port signals have to be translated to RS232 level. For this you can use a female Artekit AK-RS232 and connect it as in the following picture.

Or you can use an AK-FT232RL breakout board to upload the firmware through USB, connected in the following way (remember to set the AK-FT232RL switch to 3.3V):

To upgrade the firmware use a program capable of doing X-MODEM file transfer. In this case, we are going to use TeraTerm.

Follow this steps:

1) Disconnect the USB cable from the AK-CMSIS-DAP.

2) Connect the PC COM cable to the AK-RS232 (or the USB cable to the AK-FT232RL) attached to the AK-CMSIS-DAP.

3) Open the COM port at 115200, 8 bits, No parity, 1 stop bit, no flow control.

4) Press the BOOT push button on the AK-CMSIS-BOARD and keep it pressed while connecting the USB cable. Wait a few seconds until the yellow (ACT) LED starts to blink. At this point you can release the BOOT push button.

5) In the terminal program you can see a message like the following:

5) Press any key in the terminal program.

6) Select the file to transfer clicking File/Transfer/XMODEM/Send… as in the next picture:

7) Select the file name to transfer.

8) Click the Open button. The transmission should start and you will see a progress bar.

CMSIS-DAP firmware

The CMSIS-DAP firmware is provided as source code and is fully configurable to a new debug unit. A source code template and several reference implementations for popular debug units are provided. Refer to Firmware configuration for more information.

The CMSIS-DAP firmware stack is composed of the following components:

Похожие публикации