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

Internal pull-up algorithm test #246

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hovercraft-github
Copy link
Collaborator

This patch provides a test case which demonstrates a problem with implementation of pull-ups in simavr.
The firmware configures three pins of port D as internally pulled-up inputs, other three pins of the same port as outputs, then connects push buttons to every input, simulates key presses and translates inputs state to the outputs, one by one.
ATTENTION: This test fails on the current simavr version, the solution will be provided later.
See issue #204 for details.

@benedekt
Copy link

benedekt commented Mar 4, 2022

I've just ran into this bug head on.

My project uses internal pullups to detect button pushes, but the simulator fails to control any pins where the pullups are enabled.

Do we have a solution for this as of 2022?

Not ideal workaround: (have not tried yet, but will)
Poll the AVR core to find input pins with pullups, and disable them in the main loop from simulator code - this makes the changes transparent for the client code.

@gatk555
Copy link
Collaborator

gatk555 commented Mar 17, 2022

What behaviour do you see? The example given in #204 is sufficiently complicated that it is not really clear. My guess is that the complaint was about the behaviour that is clear in the code: any write to a port that has a pulled-up input pin will set the pin state to one.

I believe there are two fixes for this: either comment-out the pullup code; or monitor writes to PORTx and assert the wanted state in response. MP suggest the second in a comment on #204. I pushed a commit in my fork that adds the conditional compilation, but left pullups enabled by default. (ef0e7a5)

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.

3 participants