Internal pull-up algorithm test#246
Internal pull-up algorithm test#246hovercraft-github wants to merge 2 commits intobuserror:masterfrom
Conversation
demonstrating AVR internal pull-ups work simulation.
|
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) |
|
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) |
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.