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

usb library sometimes causes avr to reset #3

Open
borb opened this issue Aug 28, 2020 · 4 comments
Open

usb library sometimes causes avr to reset #3

borb opened this issue Aug 28, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@borb
Copy link
Owner

borb commented Aug 28, 2020

on occasion, what might be a bug in the uhs library causes the avr to reset. when this occurs, the amiga is reset because the reset line is asserted (or maybe AMIGA_INITPOWER & AMIGA_TERMPOWER). stop this from resetting the amiga; a keyboard glitch should not reset the machine.

it could be that setting up the active high/active low status of the reset pin is causing the reset. don't init the registers to zero, set directly to direction and see if that solves things.

shame that simulating an error in a fairly reliable library isn't actually that simple. let's try to fix anyway.

@borb borb changed the title usb library sometimes causes ave usb library sometimes causes avr to reset Aug 28, 2020
@borb borb added the enhancement New feature or request label Aug 28, 2020
@borb
Copy link
Owner Author

borb commented Oct 27, 2020

The problem is less the USB library and more the fact that the Amiga 500 reset line is active low, thus high is considered the normal state. When the Arduino resets, the ports are also reset so for a moment until the line is brought high again, the low state is enough to trigger an Amiga reset.

If the interface is modified to have a pullup, then we'll lose reset but the line will be held high and thus will be kept active, at the expense of losing reset. The A1000 & A2000 keyboards reset by holding KCLK low for at least 500ms, but it's likely that mechanism doesn't work on the A500 owing to the reset line. Could be worth trying though.

@borb
Copy link
Owner Author

borb commented Oct 27, 2020

Disabling the wdt is likely a bad idea since a crash can mean that the keyboard becomes completely useless until a power cycle occurs.

@borb
Copy link
Owner Author

borb commented Oct 27, 2020

Could use a simple transistor circuit NOT or a 555; transistor would be easier: arduino reset line to base through resistor, power on base sinks collector's input from vcc to ground (pulling low), so base low closes stops emitter sinking to ground thus letting emitter output feed the Amiga reset line.

                         ______ Vcc 5V
                            \
                            /
                        r2  \
                            /
                          __|___ to amiga reset
                r1      |/
 arduino krst -\/\/\/---|
                        |\>_
                            |
                            |
                          -----
                           ---
                            -   ground

r1 & r2 should be calculated to avoid >5V going through reset (though open base means collector to ground, so arduino krst low would mean empty base thus no additional voltage, plus that's on emitter not collector).

@borb
Copy link
Owner Author

borb commented Oct 27, 2020

(just occurred to me that I have a few hundred 74hc04d hex inverters on hand, will test when I get a chance)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant