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

Moder register not being reset after with-input method called #358

Closed
jg2562 opened this issue Apr 21, 2022 · 1 comment · Fixed by #359
Closed

Moder register not being reset after with-input method called #358

jg2562 opened this issue Apr 21, 2022 · 1 comment · Fixed by #359

Comments

@jg2562
Copy link
Contributor

jg2562 commented Apr 21, 2022

When using the with-input method on an output pin, the next outputs will be "eaten" and no longer physically happen. I tested with the stm32h723zg nucleo board. It happened for every pin I tried as well.

I created a minimal-ish test case for it here for anyone that wants to test it out.

@jg2562 jg2562 changed the title With-input method eating previous outputs Moder register not being reset after with-input method called Apr 21, 2022
@jg2562
Copy link
Contributor Author

jg2562 commented Apr 21, 2022

I investigated some more and found that the MODER register is being left in the input state rather than switching back to the output state. What I used to investigate the issue is on the branch debug of the earlier posted repo.

I'm not sure exactly how the registers are being set with the with_<mode> methods, so I do not yet have an idea for a PR. If anyone has any ideas it would be greatly appreciated!

bors bot added a commit that referenced this issue Apr 24, 2022
359: Convert ResetMode to own witness pin and track past pin mode r=richardeoin a=jg2562

Previously when resetting it would assume the pin was in the ORIG pin mode and try to convert it to the ORIG pin mode, which the if statements in mode blocked. Now by tracking the witness pin and the original MODE the reset can properly set the mode register bits.

By fixing ResetMode it allows for the `with_<mode>` methods to work and set the MODER bits. Fixes #358.

Since I've fairly new to heavy generics and microcontroller level optimization, it would be really great if someone could double-check that this doesn't break anything the previous implementation upheld! Thank you!

Co-authored-by: Jack Garrard <jg2562@nau.edu>
Co-authored-by: Richard Meadows <962920+richardeoin@users.noreply.github.com>
@bors bors bot closed this as completed in #359 Apr 24, 2022
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 a pull request may close this issue.

1 participant