Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug probe pins API #1478

Merged
merged 3 commits into from
Dec 13, 2022
Merged

Debug probe pins API #1478

merged 3 commits into from
Dec 13, 2022

Conversation

flit
Copy link
Member

@flit flit commented Nov 26, 2022

This patch adds a new API to the DebugProbe abstract class to enable reading and writing of pins provided by the debug probe. Presence of this API is indicated by the probe having the DebugProbe.Capability.PIN_ACCESS capability.

This pins API is quite simple and rather limited in some ways. For protocol-type pins, it's fine. But for GPIO you'd probably want more explicit control.

Support is included for the CMSIS-DAP and Segger JLink probe drivers.

New API methods:

DebugProbe.get_accessible_pins(group: PinGroup) -> None
Returns the readable and writable for a given pin group.

DebugProbe.read_pins(group: PinGroup, mask: int) -> int
Read a selection of pins from one group.

DebugProbe.write_pins(group: PinGroup, mask: int, value: int) -> None
Write a selection of pins from one group.

There are currently two pin groups defined:

  1. DebugProbe.PinGroup.PROTOCOL_PINS — the usual SWD/JTAG/reset pins
  2. DebugProbe.PinGroup.GPIO_PINS — reserved for future access of GPIO pins provided by a debug probe, not implemented by any debug probe driver yet (it's possible for JLink, but I don't have a JLink with GPIO so couldn't test)

Other changes:

  • Added accessible-pins and pins values to use with set and show commands.
  • Fixed type errors in JLink probe driver.

- DebugProbe: Add Pin class with pin mask constants, .read_pins() and
.write_pins() methods, and .readable_pins and .writable_pins properties.
- CMSISDAPProbe, JLinkProbe: implement new pin access APIs.
- pyDAPAccess: Add .pin_access() API for sending DAP_SWJ_Pins command
from CMSISDAPProbe.
Allows direct use of new debug probe pin access API.
@flit flit merged commit 95c0ac5 into pyocd:develop Dec 13, 2022
@flit flit deleted the feature/debug_probe_pins_api branch December 26, 2022 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant