Skip to content

mimxrt10xx: Implement pin claiming, pin reset, and pin protections #2898

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

Merged
merged 4 commits into from
May 20, 2020
Merged

mimxrt10xx: Implement pin claiming, pin reset, and pin protections #2898

merged 4 commits into from
May 20, 2020

Conversation

hierophect
Copy link
Collaborator

@hierophect hierophect commented May 15, 2020

This PR expands the Microcontroller/Pin module to allow pin objects to be claimed and reset in the context of a python program. Claiming prevents pins that have previously been used for a peripheral instance from being used again without a de-init, and resetting returns pins to their startup state. All pins except those in the never_reset array are automatically reset at startup and soft reboots.

This ended up being a little trickier than it usually is for other ports, since the i.MX does not have a pin reset function in the SDK, and has unique reset values for many pins. Additionally, it is more difficult to iterate through pins on the i.MX since GPIO banks are frequently left incomplete, with fewer than 32 pins included per bank. I resolved this by adding an iterable pin array and some new values to the pin object, but I'm open to any and all suggestions on approach!

This makes some assumptions about what pins to include in never_reset for the feathers, since I don't have their schematics - @arturo182 and @tannewt, please double check these if you can to ensure my guesses are correct.

Tested on 1010 EVK, still double checking the 1020 and 1060 so should not be merged until those are done.

resolves #2486
resolves #2481
resolves #2479

@hierophect hierophect requested review from tannewt and arturo182 May 15, 2020 17:07
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

This looks like a good start! Just a couple comments.

Copy link
Collaborator

@arturo182 arturo182 left a comment

Choose a reason for hiding this comment

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

Good work! Some comments and ideas

@hierophect hierophect marked this pull request as ready for review May 19, 2020 19:33
@hierophect hierophect requested review from tannewt and arturo182 May 19, 2020 19:34
@hierophect
Copy link
Collaborator Author

@tannewt @arturo182 issues reworked, this should be good for re-review.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Looks good to me too! Thanks!

@tannewt tannewt merged commit 0af5dd5 into adafruit:master May 20, 2020
@hierophect hierophect changed the title MIMXRT: Implement pin claiming, pin reset, and pin protections mimxrt10xx: Implement pin claiming, pin reset, and pin protections May 20, 2020
@hierophect hierophect deleted the mimxrt-claiming branch May 20, 2020 19:06
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.

mimxrt10xx: Implement never-reset pins and pin resetting mimxrt10xx: Implement the never-reset functionality mimxrt10xx: Implement pin claiming
3 participants