Aarhus-University-MPE / ArcticRover

2 stars 0 forks source link

Heartbeat race condition #8

Open grinsted opened 2 years ago

grinsted commented 2 years ago

ArcticRover firmware version

No response

Area(s) with issue?

General

Steps to reproduce

I have not experienced this issue, but i believe this to be a bug.

Lets imagine that heartbeat link between the two arduinos is broken. This means that neither will get heartbeats and they will both attempt to reset each other. There is no predicting which comes first. If the nano wins, then you could imagine it would keep winning if it takes any time at all for the mega to startup, because the nano will have a headstart on its timer.

✔️ Expected Behavior

n/a

❌ Actual Behavior

n/a

MadsR commented 2 years ago

For this to occur, both heartbeat connections would need to be broken (Backup -> Primary and Primary -> Backup), while reset pins are connected (Backup -> Primary and Primary -> Backup).

The worst case situation is where Primary Heartbeat -> Backup is faulty, resulting in backup cpu constantly trying to reset primary cpu. To fix this, adding an initial heartbeat requirement for reset features to be active.

Example - Current Initial start -> No heartbeat is received from either parts Both systems will after 60 seconds try to reset each other

Example - Proposed Initial start -> No heartbeat is received from either parts Both systems will wait for an initial heartbeat, before timeouts result in attempted restarts