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

Feature: samd: Implemented support for the SAMC21 series #1659

Merged
merged 2 commits into from
Oct 30, 2023
Merged

Feature: samd: Implemented support for the SAMC21 series #1659

merged 2 commits into from
Oct 30, 2023

Conversation

koendv
Copy link
Contributor

@koendv koendv commented Oct 29, 2023

Detailed description

This PR adds a new target: Atmel SAMC21.

  • The PR was tested on a Atmel SAMC21N18A (rev E) M0+, with parameters:

    • did: 0x11011420
    • family: 2
    • series: 1
    • devsel: 32
  • SAMD_DID_MASK was changed from 0xff380000U to 0xfe380000U.
    This allows SAMC21 parts where DID begins with 0x11 to be accepted.

  • SAMD_DID_FAMILY_MASK was changed from 0x3fU to 0x1fU.
    According to the datasheet, the field "family" in the DID Device Identification Register is a 5 bit field, so the mask ought to be 0x1f, not 0x3f.

  • sample gdb session attached:
    samc21.txt

Your checklist for this pull request

  • I've read the Code of Conduct
  • I've read the guidelines for contributing to this repository
  • It builds for hardware native (make PROBE_HOST=native)
  • It builds as BMDA (make PROBE_HOST=hosted)
  • I've tested it to the best of my ability
  • My commit messages provide a useful short description of what the commits do

Closing issues

fixes #890

@dragonmux
Copy link
Member

Before we go and review this, please correct your commit message to comply with the contribution guidelines. This modifies the file samd.c in the target tree, so should be suffixed like: samd: Implemented support for the SAMC21 series.

@dragonmux dragonmux added this to the v2.0 release milestone Oct 29, 2023
@dragonmux dragonmux added the New Target New debug target label Oct 29, 2023
Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of items to address, one of which technical rather than stylistic. With those addressed and the commit message point sorted, this looks good and we'll be happy to accept the PR.

src/target/samd.c Outdated Show resolved Hide resolved
src/target/samd.c Outdated Show resolved Hide resolved
@koendv koendv mentioned this pull request Oct 30, 2023
6 tasks
@koendv koendv changed the title new target: samc21 samd: Implemented support for the SAMC21 series Oct 30, 2023
@koendv koendv changed the title samd: Implemented support for the SAMC21 series Feature: samd: Implemented support for the SAMC21 series Oct 30, 2023
Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now needs rebasing on main due to #1662, but once done we'll mark it as accepted and merge. Thank you for fixing those issues.

@koendv
Copy link
Contributor Author

koendv commented Oct 30, 2023

OK, thanks.
FYI: A side issue. When I connect to an SAMC21, sometimes "mon swd" is instantaneous; sometimes there is a 2 second delay. If there is a delay when connecting, BMDA the gives the following message:

koen@nuc:~/src/blackmagic$ ./src/blackmagic 
Listening on TCP port: 2000
Halt via DHCSR(02000001): failure after 2001ms
Try again with longer timeout or connect under reset
adiv5: Failed to prepare AP, results may be unpredictable

If I then try "mon swd" a second time it's instantaneous; no error message; works fine.
This is just FYI.

@dragonmux
Copy link
Member

Please could you use BMDA and run src/blackmagic -tv 5 twice in a row, capturing the log both times, so we can look into that and see what's going on there as that DHCSR value does indeed show the core not halting for some reason. Please open a new issue ticket with your results.

@dragonmux dragonmux merged commit f1cd9f2 into blackmagic-debug:main Oct 30, 2023
6 checks passed
@koendv koendv deleted the samc21 branch November 1, 2023 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Target New debug target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request SAMC21 support
2 participants