You need to use phase detector II, which guarantees phase AND frequency lock. For lowest jitter, use a high-quality (low leakage, low dielectric absorption) capacitor such as polypropylene or polystyrene in your loop filter. Keep in mind that your VCO will be running basically open loop between positive transitions of your input signal (512Hz). RC oscillators inherently have more phase jitter than LC (better) or crystal (best) oscillators. If you can live with a little jitter, you should be OK.