sweetlilmre / tapuino

tapuino
http://www.sweetlilmre.com
MIT License
132 stars 49 forks source link

Handle Sense pin in an open-collector fashion #52

Closed SukkoPera closed 3 months ago

SukkoPera commented 4 months ago

The Sense pin on the original Datassette is a physical switch that only grounds the line when pressed, it's left floating when no keys are pressed. This means that the pin should be driven in an open-collector fashion, otherwise it can create problems, in particular on the Plus/4 where the Sense line is shared with data pin 2 of the User Port.

This could be compensated in hardware (put a diode in series, cathode to Arduino side) or in software, by taking advantage of the way ATmega pins are configured, which is what we do here:

This change is tested and working on Plus/4.

sweetlilmre commented 4 months ago

Hi and thanks for the PR, I didn't realise this and that there were issues with the Plus4. Have you tested this on a C64 as well? I'm happy to merge on confirmation of that.

SukkoPera commented 4 months ago

Well, maybe no one realized so far because there's not that much hardware for the userport on the +4 :). But I'm working on porting the WiC64 interface and this hit me immediately.

I was planning on doing the C64 test yesterday but got stuck into preparations for my holidays. I will test once I'm back and will report accordingly, but I would be very surprised if it doesn't work as I have checked the schematics and the Sense line pull-up resistor is right there.

sweetlilmre commented 4 months ago

Ok great. I'll try and give it a test myself, but all my kit is packed away, so might take some time. Let me know and if I get to it first and it's all good, I'll merge. Enjoy your holidays! :)

SukkoPera commented 3 months ago

Tested and working fine on C64!

sweetlilmre commented 3 months ago

Merged! Thank you!