ARMmbed / ARMmbed/DAPLink

CDC break reset doesn't work with SW reset

Open
#611 2 comments 0 reactions 0 assignees View on GitHub
bug to do
Dominant language
C
Stars
2.8k
Forks
1.1k
Avg merge
3d 12h
Merged PRs (30d)
1

Description

A CDC break to trigger target reset does not properly reset targets that use software reset. The underlying issue is that `swd_set_target_reset()` in `target_family.c` does not support software reset. The call sequence goes `target_set_state(RESET_HOLD)` –> `target_set_state_sw(RESET_HOLD)` –> `swd_set_target_reset()`, which then simply controls the nRESET pin.

Part of the problem here is that `SYSRESETREQ` and `VECTRESET` are both auto-clear bits, so you can't hold the core in reset using these controls.

Tasks:
1. The logic to support software reset will have to be moved higher.
2. Make `swd_set_target_reset()` handle software reset? Maybe it should just cause an immediate sw reset. Or perhaps it should just assert.
3. `target_set_state_sw()` must assert if called with `RESET_HOLD` since that is not valid.

Contributor guide

Open the contributing guide

Research direction

Start in target_family.c and trace target_set_state(RESET_HOLD), target_set_state_sw(RESET_HOLD), and swd_set_target_reset(). Check how software reset uses SYSRESETREQ and VECTRESET and whether existing reset behavior covers the change. Done means CDC break reset works for software-reset targets, RESET_HOLD is rejected by target_set_state_sw(), and the reset semantics are consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
devtools, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.