SoC
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
  • Arm Cortex M3
  • Contact
Reading: Force get access to Cortex-M0 if SWDIO is disabled on startup Cortex M0
SUBSCRIBE
SoCSoC
Font ResizerAa
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
Search
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
Have an existing account? Sign In
Follow US
  • Looking for Something?
  • Privacy Policy
  • About Us
  • Sitemap
  • Contact Us
© S-O-C.ORG, All Rights Reserved.
Arm

Force get access to Cortex-M0 if SWDIO is disabled on startup Cortex M0

Neil Salmon
Last updated: October 5, 2023 9:58 am
Neil Salmon 6 Min Read
Share
SHARE

The Cortex-M0 is an ARM processor targeted at microcontroller applications. It is an extremely low power and low cost processor used in a wide range of embedded systems. The SWDIO (Serial Wire Debug I/O) interface on the Cortex-M0 provides debug access and programming capability. However, if SWDIO is disabled on startup, it can be challenging to get debug access to the chip.

Contents
Use JTAG Instead of SWDIOUse DAP Direct JTAG ModeReset the ChipUse a Debug Authentication InterfaceDirectly Unlock SWDIO Through a Debug InterfacePhysically Bypass Debug LockoutsReplace Firmware or Flash MemoryContact the ManufacturerKey Things to Remember

There are a few potential ways to force SWDIO access on a locked down Cortex-M0:

Use JTAG Instead of SWDIO

Many Cortex-M0 chips have both SWDIO and JTAG interfaces. While SWDIO may be disabled, the JTAG interface may still be enabled. JTAG provides similar debug and programming access at a hardware level. You would need a JTAG debugger instead of an SWDIO debugger, but it presents an alternate way to access the chip.

Use DAP Direct JTAG Mode

Some SWDIO debuggers like the CMSIS-DAP also support a direct JTAG mode. This can directly speak JTAG bypassing the SWDIO interface. To enable this mode, you need to add jumpers or headers on the circuit board for the JTAG pins (TCK, TMS, TDI, TDO). Then connecting a debugger like a CMSIS-DAP in its JTAG mode can communicate directly with the JTAG port.

Reset the Chip

For some devices, issuing a hard reset like power cycling or reset pin toggling can temporarily re-enable SWDIO access. The CPU will boot into debug mode for a short time on reset before locking SWDIO again. If you are fast enough on reset, you may be able to halt the CPU and reprogram SWDIO settings over SWDIO before it disables again.

Use a Debug Authentication Interface

Some Cortex-M0 devices include an optional Debug Authentication Interface. This provides a password challenge/response protocol to authenticate a debug host and temporarily unlock debug access. If the device has this feature, you need to know the correct password challenge/response protocol. This is often proprietary to the silicon vendor. But if you have the right credentials, you can use the authentication interface to temporarily unlock SWDIO.

Directly Unlock SWDIO Through a Debug Interface

Once you have initial JTAG access via one of the above methods, you may be able to directly write to memory or registers related to SWDIO locking. This would let you reconfigure the device to permanently unlock SWDIO access. Depending on the specific chip, you may need to rewrite flash configuration sectors, OTP memory, or chip configuration fuses.

Physically Bypass Debug Lockouts

As a last resort, it is sometimes possible to physically bypass debug lockout mechanisms on the PCB. Common methods include:

  • Cutting the enable/disable pin trace for SWDIO
  • Cutting flash write protect pin traces
  • Grounding the reset pin
  • Removing or replacing debug lockout flash/OTP/fuse components

These types of modifications likely require soldering skills and schematics of the PCB. They also run the risk of permanently damaging the board. But if designed carefully, they can disable onboard debug locks and restore SWDIO.

Replace Firmware or Flash Memory

As a last resort if all on-chip debug capabilities are locked out, you may need to replace the chip’s flash memory or firmware entirely. This could mean desoldering the flash chip and replacing with an unlocked version. Or loading new firmware via external interfaces like UART or USB bootloader modes. This is often challenging but if the flash memory itself is the root of the SWDIO lockout, it may be required.

Contact the Manufacturer

For most commercial chips and boards, the silicon vendor or OEM will have ways to unlock debug access like SWDIO for their products, even if all standard interfaces are locked. This may require contacting their technical support and going through an unlocking process. Often times they have proprietary tools, methods, or internal fuses/controls that can restore SWDIO. Reaching out to them should be one of the first steps attempted in any locked down situation.

Key Things to Remember

  • Try identifying alternate debug interfaces like JTAG
  • Use debuggers that support multiple low-level debug protocols
  • Look for chip reset modes or timed power cycle techniques
  • Check for debug authentication interfaces and credentials
  • Attempt reading and rewriting any related unlocking registers or fuses
  • Consider physical PCB modifications to remove debug blocks
  • Leverage external non-debug interfaces if possible
  • Always reach out to the device manufacturer for support

With various clever techniques, most SWDIO lockout situations can be recovered from. The key is thoroughly understanding the specific debug architecture and options available. With persistence and creativity, SWDIO access can often be forcefully restored.

Newsletter Form (#3)

More ARM insights right in your inbox

 


Share This Article
Facebook Twitter Email Copy Link Print
Previous Article Use the same ISR for multiple interrupt sources in Cortex M0+
Next Article Steps Required to do Synthesis and FE Sign-off of ARM Cortex M0
Leave a comment Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

2k Followers Like
3k Followers Follow
10.1k Followers Pin
- Sponsored-
Ad image

You Might Also Like

ipsr register cortex-m4

The ipsr register is an important part of the ARM…

6 Min Read

How much memory does the Cortex-M3 have?

The Cortex-M3 is an ARM processor core that is targeted…

5 Min Read

Using ST-Link debugger with Cortex-M1 FPGA design

The ST-Link debugger is an extremely useful tool for debugging…

6 Min Read

Is CMSIS a library?

Yes, CMSIS stands for Cortex Microcontroller Software Interface Standard and…

7 Min Read
SoCSoC
  • Looking for Something?
  • Privacy Policy
  • About Us
  • Sitemap
  • Contact Us
Welcome Back!

Sign in to your account