Dynamic frequency detection