I am trying to use the new Programmer shield with OpenOCD and SWD via the 20-Pin JTAG header on the board. I have confirmed that OpenOCD works with my Photon but I am struggling with the SWD connection from the JTAG pins. This is my cfg file that I have tried which is an edit of the Particle-ftdi.cfg but trying to add the bits for SWD. Do any of the smart guys out there no where I can find the proper values for this cfg file? @mohit I think you built the shield so tagging you in hopes you might know already.
The goal is to be able to support Particle and Bluz debugging/flashing from the Particle Programmer…
I am struggling with the programmer as well. I am using the WICED tools to develop my solution with the intent of starting production with a Photon module and eventually switching to a P0/USI module after the software is stable and the product proves successful. I am specifically using the BCM943362WCD4_EVB for development. I am using OS X for development. I have had no issues with the Broadcom tools or EVB, but my initial experience programming the Photon has not been what I expected. I expected that I could talk to and program the Photon with the "Programmer Shield". After a few hours, I'm still struggling. Initially I tried the methods described in several Particle.io sites.
After having no success, I followed this process:
It at least set up the FT2232H exactly the same way as the EVB. I've studied all the schematics and pin outs and I'm still coming up empty. I've tried about every configuration of the .CFG files recommended.
**** OpenOCD failed - ensure you have installed the driver from the drivers directory, and that the debugger is not running **** In Linux this may be due to USB access permissions. In a virtual machine it may be due to USB passthrough settings. Check in the task list that another OpenOCD process is not running. Check that you have the correct target and JTAG device plugged in. ****
I have looked at about everything I can think of and was wondering if anyone can share the secret to using the "Programmer Shield".
Before I answer the question, let me say exactly how and why I got myself here. I am developing a product on the WICED tools set. This is a much more complicated development environment than the Particle environment. I have developed my solution using the Broadcom WICED Eclipse environment. I want to plug my Photon programmer into my OS X development system and not have to do the rumored loading and unloading of drivers as described on various other threads. Therefore, I figured the WICED tools worked well enough that I could morph my Photon programmer and Photon to look like the WICED Evaluation board. I followed a process described on Broadcom's community board that allowed me to copy an image to the 93C46 on the programmer to make the programmer appear like the WICED EVB. That was easy. At the moment of truth, it failed. After looking at the debug messages from OpenOCD and digging a little, I finally found the key. Particle.io protects memory so that the device is recoverable.
Now, for the problem. I have code running over there, just not the wifi part. I am still looking at that to see why. However I discovered that Particle attempted to protect us against ourselves by protecting various blocks of code.
telnet: connect to address ::1: Connection refused
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
flash info 0
device id = 0x20036411
flash size = 1024kbytes #0 : stm32f2x at 0x08000000, size 0x00100000, buswidth 0, chipwidth 0
# 0: 0x00000000 (0x4000 16kB) protected
# 1: 0x00004000 (0x4000 16kB) not protected
# 2: 0x00008000 (0x4000 16kB) not protected
# 3: 0x0000c000 (0x4000 16kB) not protected
# 4: 0x00010000 (0x10000 64kB) not protected
# 5: 0x00020000 (0x20000 128kB) protected
# 6: 0x00040000 (0x20000 128kB) protected
# 7: 0x00060000 (0x20000 128kB) protected
# 8: 0x00080000 (0x20000 128kB) protected
# 9: 0x000a0000 (0x20000 128kB) not protected
# 10: 0x000c0000 (0x20000 128kB) not protected
# 11: 0x000e0000 (0x20000 128kB) not protected
STM32F2xx - Rev: X
Once I saw this, I knew the problem and the solution. For those who are faint-of-heart. Don't do this:
flash protect 0 0 11 off
cleared protection for sectors 0 through 11 on flash bank 0
Hope this helps somebody else save a bunch of time if they are doing the same thing.
I don’t think that the Programmer Shield supports SWD without modification. The SWDIO is bidirectional, but the FT2232H. Other JTAG devices using the FT2232H implement the bidirectional pin with external logic
This is an old thread now, but it seems to be the most on-point to answer the question “can I use the Particle Programmer Shield to program/debug my SWD-only device?” The answer seems to be no, but I was hoping to see a staffer reply definitively. Any news?