Skip to content

Serial watchdog false positives when idle - implement keepalive #59

@kmatzen

Description

@kmatzen

Problem

When the phone is idle (no keypad, coins, or hook events), neither the Pi nor the Arduino sends anything on the serial link. The serial watchdog in millennium_client_check_serial only counted reads as activity, so after 30 seconds it falsely marked the link dead and triggered a reconnect. Reconnect sends 'f' to re-init the coin validator, which spins the motor.

We fixed part of this in PR #58 by:

  • Treating writes as activity
  • Increasing the watchdog timeout to 300 seconds

But nothing writes to the serial while idle either - display and coin validator commands only happen on user interaction. So after 5 minutes of true inactivity, the watchdog can still false-positive.

Proposed solution

Implement a periodic keepalive - a low-overhead message exchanged between Pi and Arduino (e.g. every 30–60 seconds) that:

  • Resets the watchdog's activity timer
  • Confirms the link is alive
  • Does not trigger the coin validator motor or other side effects

Options to explore:

  1. Pi sends a harmless command (e.g. display no-op or a dedicated keepalive byte); Arduino sends a simple ack
  2. Arduino-initiated keepalive (requires display firmware change)
  3. A minimal polling protocol that both sides understand

Current workaround

The watchdog is disabled until this is resolved (see SERIAL_WATCHDOG_ENABLED in millennium_sdk.h).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions