Skip to content

Parity & Overflow check, plus trimming#3

Open
ghost wants to merge 7 commits into
morphinejh:testingfrom
N0t4R0b0t:main
Open

Parity & Overflow check, plus trimming#3
ghost wants to merge 7 commits into
morphinejh:testingfrom
N0t4R0b0t:main

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Jan 6, 2025

I was running into issues with a KVM as well, a D-Link DKVM-8E, it sometimes has a bit of a brain fart and send the cursor flying across the screen and clicking randomly. When this happens, most of the time, there are parity errors on the packets or the overflow bits on the X and/or Y movement are set, so I finished implementing the parity check stub in the code and added an X/Y overflow check. This made the adapter usable for me, but I would still occasionally have the cursor teleport across the screen, so I added a simple mechanism to trim out the movements that are above a configurable limit, this feature is enabled by a jumper(D13) and the limit value is set with a pot (A1). I found in my tests that a movement >128 is very likely an error, so this solved all the issues for me. Hope it helps.

@morphinejh
Copy link
Copy Markdown
Owner

I haven't had a chance to look at this yet, but its on my list. I like the idea of the parity check working. Hopefully in the next few weeks. In lieu of a schematic, would you be able to post picture of the potentiometer setup?

@ghost
Copy link
Copy Markdown
Author

ghost commented Jan 21, 2025

Sure, It's very simple, you take a pot of any value, middle goes to A1, and then one side goes to 5V and the other the gnd. But again, you can totally ignore the trimming feature.
My prototype ins't exactly pretty, but functional:
20250120_210812
20250120_210708

Converted Serial connection to a HW implementation. Improved resilience of PS2 communication with error detection and connection timeouts.
@morphinejh morphinejh self-assigned this Feb 10, 2025
@morphinejh morphinejh added the enhancement New feature or request label Feb 10, 2025
@morphinejh morphinejh changed the base branch from main to testing February 10, 2025 23:32
Copy link
Copy Markdown
Owner

@morphinejh morphinejh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer these be 3 separate pull requests. I will review them and consider integrating separately, after more testing. Leaving notes here for future reference.

1 - Parity check will most likely be integrated with some code changes to keep data types the same.

2 - Analog trimmer will probably not be integrated. It solves a very niche problem and requires soldering outside of the design.

3 - It would have been better to switch the debug output over to use software serial, as the software serial was converted to hardware serial. I am currently considering a separate branch for hardware serial.

@ghost
Copy link
Copy Markdown
Author

ghost commented Feb 11, 2025

Makes sense, but unfortunetely I won't have much time to invest in this anytime soon. I can share that I have an 8 port KVM and tested this device with my version of the firmware with everything from an 8088 to a pentium-III (from ctmouse V1.9 and V2.1 on DOS 3.3 to windows 95) and had zero issues. I am super happy with the current shape. Here is some feedback on your notes:

  1. Yap, got lazy, good enough for me... Just keep in mind that parity check isn't the only error handling I implemented, there were a few other that are equaly important and the combination of all of them allows the device to quickly detect and recover from issues hopefully before the mouse user realizes there is an issue:
    • Checking if the static number 1 is in the middle of the first PS/2 packet, that works like an index hole on a floppy disk, it's a very quick check to see if you captured the event on the first packet and didn't loose sync.
    • Check if the movement overflowed on any axis: if such an overlfow situation was correct, the mouse pointer will jump accross the screen, that just can't be right.
    • On the while loops waiting for clock to go low/high, that needs a timeout, I had a lot of situations where the device would just freeze due to that.
    • Count the error on the loop function and reset the PS2 connection when you get a bunch of errors in a row, it allows the device to recover from a mouse "freak out".
  2. Yap, I dropped that myself after I moved to HW Serial, it's reliable enought that it's not worth the effort to implement a trim mech.
  3. I would advise against it, it's just not worth the effort and potential issues of doing a SW serial stream just for debugging, the serial connection is the one thing that never gave me issues, it's very reliable, the PS/2 side is the more problematic part. With the HW serial, we can trust that this part is hadled properly and we can monitor the theoutput of that directly if we need to debug. Also adding SW Serial would add another potential source of issues, since it takes actual CPU time so the debug mode would could lead to timing issues you would not have otherwise.

I hope this info helps, if you have any questions, feel free to reach out if have any questions

N0t4R0b0t and others added 4 commits May 8, 2026 09:37
- Created a new footprint for the Arduino Nano socket with 2x15 pin configuration, including through-hole pads and silk screen details.
- Added a footprint for the MAX3232 HW-027 module featuring castellated pads, through-hole and SMD pads, along with necessary fabrication outlines.
…ct file

- Changed the active layer in the project file from 2 to 0 for better visibility.
- Updated the Arduino Nano Socket footprint to a new version with enhanced properties and formatting.
- Added detailed properties for reference, value, datasheet, and description with UUIDs.
- Expanded pad definitions to include all 30 pins with consistent attributes and UUIDs.
- Improved the footprint's rectangle yard dimensions and ensured proper layer assignments.
- Rerouted traces for cleaner print output
- Fixed VBUS and jumper net assignments (were incorrectly marked unconnected)
- Expand .gitignore to exclude KiCad autosave, lock, cache, history, and .kicad_prl
- Untrack .kicad_prl (machine-specific local preferences)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

2 participants