Comments (3)
For JTAG in CMSIS-DAP there are two distinct modes. First one is the normal transfers. This is ARM specific, but more standard, of course.
For this mode to work, simply replace
dap_connect(DAP_INTERFACE_SWD);
with
dap_connect(DAP_INTERFACE_JTAG);
dap_jtag_configure(2, (int[]){ 4, 5 });
dap_jtag_set_index(0);
Here 4 and 5 are IR lengths of the devices in the JTAG chain. Many ARM device (STM32f4xx in this case) have 2 devices in the chain. One is for boundary scan (5) and one for the ARM core (4). devices are declared in the order starting from the end of the chain (first device attached to TDO). And index is the index of the device corresponding to the ARM core (0 in this case, as the core is last in the chain).
After that the resto of the code would work as is. In my tests I used "dap_read_word(0xe0042000);". This is where ID of the device is located. And this worked for both JTAG and SWD mode only with the change above. I did not implement the whole driver, as I have no particular need for that device. I just used it as a test target.
If there are any other external devices in the chain, they need to be added too. If there is an actual need to support some JTAG-only device, then this would be passed through the command line.
The second mode is just bit banging, which would work for any device. OpenOCD uses this mode exclusively for everything.
The example of this mode is in the function dap_jtag_scan_chain(). It does some basic operation of resetting the JTAG TAP, shifting out the DR until it reads 0, those enumerating all IDCODEs for all the devices. It then measures the total length of the IR registers in the chain (9 in this case).
This is as much of the automated identification as you can do. It is impossible to identify individual IR lengths of the devices. You just need to have a huge database of IDCODEs and corresponding lengths.
JTAG mode here was added for testing of the free-dap implementation. I just did not want to throw away the effort completely, so I packaged it into the minimal changes that made sense.
It would probably be changed a bit once there is a real need to support JTAG-only device. It is likely to be some FPGA rather than MCU though.
from edbg.
I've added a first real JTAG-only target. It is Lattice LCMXO2 FPGA.
I had a project where I needed to program the FPGA from the MCU anyway, so I just ported that code to edbg.
from edbg.
Thank you very much for such a detailed response. I'll try to play around with it a bit and will come back if I need additional support.
from edbg.
Related Issues (20)
- unknown target device HOT 1
- "Error: invalid response received" in ATSAMD11C14A HOT 16
- error_exit() function and target reset HOT 1
- Error: hid_error is not implemented yet HOT 20
- Ubuntu 20 edbg flash broken? HOT 3
- unable to unlock HOT 4
- Binary downloads HOT 7
- Programming ATsaml21e17b HOT 2
- Segmentation fault on OSX when debugger in use by openocd HOT 7
- CMSIS-DAP v2 support requirement HOT 5
- edbg compiled on Raspberry Pi 4B hangs while using free-DAP to program SAMD21 HOT 3
- RP2040 support? HOT 28
- board unusable after write fuse operation on SAML11-XPRO HOT 5
- Why is the RP2040 max flash 2MB? HOT 1
- libhidapi.0.dylib not loaded on Mac HOT 5
- Request to add entry for SAM V70N19 Rev B HOT 1
- "nanoDAP" adapter not supported in Linux HOT 2
- WAIT response after erasing flash HOT 7
- Can't list devices on Ubuntu 20.04 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edbg.