  We consider homoclinic solutions for Hamiltonian systems in symplectic
Hilbert spaces and generalise spectral flow formulas that were proved by
Pejsachowicz and the author in finite dimensions some years ago. Roughly
speaking, our main theorem relates the spectra of infinite dimensional
Hamiltonian systems under homoclinic boundary conditions to intersections of
their stable and unstable spaces. Our proof has some interest in its own.
Firstly, we extend a celebrated theorem by Cappell, Lee and Miller about the
classical Maslov index in $\mathbb{R}^{2n}$ to symplectic Hilbert spaces.
Secondly, we generalise the classical index bundle for families of Fredholm
operators of Atiyah and J\"anich to unbounded operators for applying it to
Hamiltonian systems under varying boundary conditions. Finally, we
substantially make use of striking results by Abbondandolo and Majer to study
Fredholm properties of infinite dimensional Hamiltonian systems.
